@typescript-deploys/pr-build 4.7.0-pr-48581-7 → 4.7.0-pr-48792-4
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/cs/diagnosticMessages.generated.json +2 -0
- package/lib/de/diagnosticMessages.generated.json +2 -0
- package/lib/es/diagnosticMessages.generated.json +2 -0
- package/lib/fr/diagnosticMessages.generated.json +2 -0
- package/lib/it/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +2 -0
- package/lib/ko/diagnosticMessages.generated.json +2 -0
- package/lib/pl/diagnosticMessages.generated.json +2 -0
- package/lib/protocol.d.ts +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +2 -0
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tr/diagnosticMessages.generated.json +2 -0
- package/lib/tsc.js +304 -246
- package/lib/tsserver.js +772 -380
- package/lib/tsserverlibrary.d.ts +7 -2
- package/lib/tsserverlibrary.js +772 -380
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +531 -360
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +531 -360
- package/lib/typingsInstaller.js +354 -277
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -0
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220420";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -4649,7 +4649,6 @@ var ts;
|
|
|
4649
4649
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4650
4650
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4651
4651
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4652
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4653
4652
|
// Error handling
|
|
4654
4653
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4655
4654
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8706,6 +8705,7 @@ var ts;
|
|
|
8706
8705
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8707
8706
|
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8708
8707
|
Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
|
|
8708
|
+
Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
|
|
8709
8709
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8710
8710
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8711
8711
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -14954,6 +14954,10 @@ var ts;
|
|
|
14954
14954
|
}
|
|
14955
14955
|
}
|
|
14956
14956
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14957
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14958
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14959
|
+
}
|
|
14960
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14957
14961
|
function isLateVisibilityPaintedStatement(node) {
|
|
14958
14962
|
switch (node.kind) {
|
|
14959
14963
|
case 266 /* ImportDeclaration */:
|
|
@@ -16314,17 +16318,13 @@ var ts;
|
|
|
16314
16318
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16315
16319
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16316
16320
|
}
|
|
16317
|
-
if (ts.
|
|
16321
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16318
16322
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16319
16323
|
ts.isIdentifier(initializer.expression) &&
|
|
16320
16324
|
(initializer.expression.escapedText === "window" ||
|
|
16321
16325
|
initializer.expression.escapedText === "self" ||
|
|
16322
16326
|
initializer.expression.escapedText === "global"))) {
|
|
16323
|
-
|
|
16324
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16325
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16326
|
-
}
|
|
16327
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16327
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16328
16328
|
}
|
|
16329
16329
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16330
16330
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16532,14 +16532,14 @@ var ts;
|
|
|
16532
16532
|
}
|
|
16533
16533
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16534
16534
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16535
|
-
var _a, _b
|
|
16535
|
+
var _a, _b;
|
|
16536
16536
|
switch (node.kind) {
|
|
16537
16537
|
case 254 /* VariableDeclaration */:
|
|
16538
|
-
return node.initializer.arguments[0]
|
|
16538
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16539
16539
|
case 266 /* ImportDeclaration */:
|
|
16540
|
-
return
|
|
16540
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16541
16541
|
case 265 /* ImportEqualsDeclaration */:
|
|
16542
|
-
return
|
|
16542
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16543
16543
|
default:
|
|
16544
16544
|
ts.Debug.assertNever(node);
|
|
16545
16545
|
}
|
|
@@ -17054,7 +17054,10 @@ var ts;
|
|
|
17054
17054
|
return parent.propertyName === node;
|
|
17055
17055
|
case 275 /* ExportSpecifier */:
|
|
17056
17056
|
case 285 /* JsxAttribute */:
|
|
17057
|
-
|
|
17057
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17058
|
+
case 280 /* JsxOpeningElement */:
|
|
17059
|
+
case 281 /* JsxClosingElement */:
|
|
17060
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17058
17061
|
return true;
|
|
17059
17062
|
}
|
|
17060
17063
|
return false;
|
|
@@ -17070,21 +17073,28 @@ var ts;
|
|
|
17070
17073
|
// export = <EntityNameExpression>
|
|
17071
17074
|
// export default <EntityNameExpression>
|
|
17072
17075
|
// module.exports = <EntityNameExpression>
|
|
17073
|
-
//
|
|
17074
|
-
//
|
|
17076
|
+
// module.exports.x = <EntityNameExpression>
|
|
17077
|
+
// const x = require("...")
|
|
17078
|
+
// const { x } = require("...")
|
|
17079
|
+
// const x = require("...").y
|
|
17080
|
+
// const { x } = require("...").y
|
|
17075
17081
|
function isAliasSymbolDeclaration(node) {
|
|
17076
|
-
|
|
17082
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17077
17083
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17078
17084
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17079
17085
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17080
17086
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17081
17087
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17082
17088
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17083
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17089
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17090
|
+
return true;
|
|
17091
|
+
}
|
|
17092
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17093
|
+
ts.isPropertyAccessExpression(node)
|
|
17094
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17095
|
+
&& node.parent.left === node
|
|
17096
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17097
|
+
&& isAliasableExpression(node.parent.right));
|
|
17088
17098
|
}
|
|
17089
17099
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17090
17100
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17095,6 +17105,7 @@ var ts;
|
|
|
17095
17105
|
case 275 /* ExportSpecifier */:
|
|
17096
17106
|
case 271 /* ExportAssignment */:
|
|
17097
17107
|
case 265 /* ImportEqualsDeclaration */:
|
|
17108
|
+
case 274 /* NamespaceExport */:
|
|
17098
17109
|
return node.parent;
|
|
17099
17110
|
case 161 /* QualifiedName */:
|
|
17100
17111
|
do {
|
|
@@ -18921,6 +18932,11 @@ var ts;
|
|
|
18921
18932
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
18922
18933
|
}
|
|
18923
18934
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
18935
|
+
function isRightSideOfAccessExpression(node) {
|
|
18936
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
18937
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
18938
|
+
}
|
|
18939
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
18924
18940
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
18925
18941
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
18926
18942
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19572,6 +19588,41 @@ var ts;
|
|
|
19572
19588
|
return expr;
|
|
19573
19589
|
}
|
|
19574
19590
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19591
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19592
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19593
|
+
return walkAccessExpression(name.parent);
|
|
19594
|
+
}
|
|
19595
|
+
function walkAccessExpression(access) {
|
|
19596
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19597
|
+
var res = action(access.name);
|
|
19598
|
+
if (res !== undefined) {
|
|
19599
|
+
return res;
|
|
19600
|
+
}
|
|
19601
|
+
}
|
|
19602
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19603
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19604
|
+
var res = action(access.argumentExpression);
|
|
19605
|
+
if (res !== undefined) {
|
|
19606
|
+
return res;
|
|
19607
|
+
}
|
|
19608
|
+
}
|
|
19609
|
+
else {
|
|
19610
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19611
|
+
return undefined;
|
|
19612
|
+
}
|
|
19613
|
+
}
|
|
19614
|
+
if (isAccessExpression(access.expression)) {
|
|
19615
|
+
return walkAccessExpression(access.expression);
|
|
19616
|
+
}
|
|
19617
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19618
|
+
// End of chain at Identifier 'x.y.z'
|
|
19619
|
+
return action(access.expression);
|
|
19620
|
+
}
|
|
19621
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19622
|
+
return undefined;
|
|
19623
|
+
}
|
|
19624
|
+
}
|
|
19625
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19575
19626
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19576
19627
|
while (true) {
|
|
19577
19628
|
switch (node.kind) {
|
|
@@ -20519,6 +20570,7 @@ var ts;
|
|
|
20519
20570
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20520
20571
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
20521
20572
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20573
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20522
20574
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20523
20575
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20524
20576
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21207,6 +21259,11 @@ var ts;
|
|
|
21207
21259
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21208
21260
|
}
|
|
21209
21261
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21262
|
+
function getParameterTypeNode(parameter) {
|
|
21263
|
+
var _a;
|
|
21264
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21265
|
+
}
|
|
21266
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21210
21267
|
})(ts || (ts = {}));
|
|
21211
21268
|
/* @internal */
|
|
21212
21269
|
var ts;
|
|
@@ -33118,7 +33175,8 @@ var ts;
|
|
|
33118
33175
|
var pos = getNodePos();
|
|
33119
33176
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33120
33177
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33121
|
-
|
|
33178
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33179
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33122
33180
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33123
33181
|
}
|
|
33124
33182
|
function parseTypeParameter() {
|
|
@@ -34154,7 +34212,7 @@ var ts;
|
|
|
34154
34212
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34155
34213
|
}
|
|
34156
34214
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34157
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34215
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34158
34216
|
}
|
|
34159
34217
|
function isYieldExpression() {
|
|
34160
34218
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34219,7 +34277,7 @@ var ts;
|
|
|
34219
34277
|
return addJSDocComment(finishNode(node, pos));
|
|
34220
34278
|
}
|
|
34221
34279
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34222
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34280
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34223
34281
|
if (triState === 0 /* False */) {
|
|
34224
34282
|
// It's definitely not a parenthesized arrow function expression.
|
|
34225
34283
|
return undefined;
|
|
@@ -34229,16 +34287,16 @@ var ts;
|
|
|
34229
34287
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34230
34288
|
// expression instead.
|
|
34231
34289
|
return triState === 1 /* True */ ?
|
|
34232
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34290
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34233
34291
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34234
34292
|
}
|
|
34235
34293
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34236
34294
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34237
34295
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34238
34296
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34239
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34297
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34240
34298
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34241
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34299
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34242
34300
|
}
|
|
34243
34301
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34244
34302
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34249,7 +34307,7 @@ var ts;
|
|
|
34249
34307
|
// Definitely not a parenthesized arrow function.
|
|
34250
34308
|
return 0 /* False */;
|
|
34251
34309
|
}
|
|
34252
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34310
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34253
34311
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34254
34312
|
nextToken();
|
|
34255
34313
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34269,8 +34327,13 @@ var ts;
|
|
|
34269
34327
|
// but this is probably what the user intended.
|
|
34270
34328
|
var third = nextToken();
|
|
34271
34329
|
switch (third) {
|
|
34272
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34273
34330
|
case 58 /* ColonToken */:
|
|
34331
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34332
|
+
// "a ? () : ..."
|
|
34333
|
+
return 0 /* False */;
|
|
34334
|
+
}
|
|
34335
|
+
return 1 /* True */;
|
|
34336
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34274
34337
|
case 18 /* OpenBraceToken */:
|
|
34275
34338
|
return 1 /* True */;
|
|
34276
34339
|
default:
|
|
@@ -34444,13 +34507,8 @@ var ts;
|
|
|
34444
34507
|
// This is a valid arrow function with "z" as the return type.
|
|
34445
34508
|
//
|
|
34446
34509
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34447
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34510
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34448
34511
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34449
|
-
//
|
|
34450
|
-
// For example,
|
|
34451
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34452
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34453
|
-
// be an arrow expression, so we allow a return type.
|
|
34454
34512
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34455
34513
|
return undefined;
|
|
34456
34514
|
}
|
|
@@ -34520,7 +34578,7 @@ var ts;
|
|
|
34520
34578
|
topLevel = savedTopLevel;
|
|
34521
34579
|
return node;
|
|
34522
34580
|
}
|
|
34523
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34581
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34524
34582
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34525
34583
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34526
34584
|
if (!questionToken) {
|
|
@@ -34530,7 +34588,7 @@ var ts;
|
|
|
34530
34588
|
// we do not that for the 'whenFalse' part.
|
|
34531
34589
|
var colonToken;
|
|
34532
34590
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34533
|
-
? parseAssignmentExpressionOrHigher(
|
|
34591
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34534
34592
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34535
34593
|
}
|
|
34536
34594
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35360,34 +35418,10 @@ var ts;
|
|
|
35360
35418
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35361
35419
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35362
35420
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35363
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35364
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35365
|
-
// expression.
|
|
35366
|
-
// falls through
|
|
35367
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35368
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35369
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35370
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35371
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35372
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35373
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35374
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35375
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35376
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35377
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35378
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35379
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35380
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35381
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35382
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35383
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35384
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35385
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35386
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35387
35421
|
return true;
|
|
35388
35422
|
}
|
|
35389
|
-
//
|
|
35390
|
-
return
|
|
35423
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35424
|
+
return !isStartOfExpression();
|
|
35391
35425
|
}
|
|
35392
35426
|
function parsePrimaryExpression() {
|
|
35393
35427
|
switch (token()) {
|
|
@@ -38605,7 +38639,7 @@ var ts;
|
|
|
38605
38639
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38606
38640
|
/** @internal */
|
|
38607
38641
|
function isDeclarationFileName(fileName) {
|
|
38608
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38642
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38609
38643
|
}
|
|
38610
38644
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38611
38645
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42113,7 +42147,8 @@ var ts;
|
|
|
42113
42147
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42114
42148
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42115
42149
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42116
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42150
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42151
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42117
42152
|
})(Extensions || (Extensions = {}));
|
|
42118
42153
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42119
42154
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43058,7 +43093,21 @@ var ts;
|
|
|
43058
43093
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43059
43094
|
}
|
|
43060
43095
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43061
|
-
|
|
43096
|
+
var extensions;
|
|
43097
|
+
if (lookupConfig) {
|
|
43098
|
+
extensions = tsconfigExtensions;
|
|
43099
|
+
}
|
|
43100
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43101
|
+
extensions = [Extensions.TsOnly];
|
|
43102
|
+
if (compilerOptions.allowJs)
|
|
43103
|
+
extensions.push(Extensions.JavaScript);
|
|
43104
|
+
if (compilerOptions.resolveJsonModule)
|
|
43105
|
+
extensions.push(Extensions.Json);
|
|
43106
|
+
}
|
|
43107
|
+
else {
|
|
43108
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43109
|
+
}
|
|
43110
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43062
43111
|
}
|
|
43063
43112
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43064
43113
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43067,6 +43116,10 @@ var ts;
|
|
|
43067
43116
|
var failedLookupLocations = [];
|
|
43068
43117
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43069
43118
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43119
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43120
|
+
if (compilerOptions.noDtsResolution) {
|
|
43121
|
+
conditions.pop();
|
|
43122
|
+
}
|
|
43070
43123
|
var state = {
|
|
43071
43124
|
compilerOptions: compilerOptions,
|
|
43072
43125
|
host: host,
|
|
@@ -43074,7 +43127,7 @@ var ts;
|
|
|
43074
43127
|
failedLookupLocations: failedLookupLocations,
|
|
43075
43128
|
packageJsonInfoCache: cache,
|
|
43076
43129
|
features: features,
|
|
43077
|
-
conditions:
|
|
43130
|
+
conditions: conditions,
|
|
43078
43131
|
};
|
|
43079
43132
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43080
43133
|
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
@@ -43250,9 +43303,9 @@ var ts;
|
|
|
43250
43303
|
}
|
|
43251
43304
|
}
|
|
43252
43305
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43253
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43306
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43254
43307
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43255
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43308
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43256
43309
|
}
|
|
43257
43310
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43258
43311
|
}
|
|
@@ -43282,20 +43335,22 @@ var ts;
|
|
|
43282
43335
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43283
43336
|
}
|
|
43284
43337
|
case Extensions.TypeScript:
|
|
43338
|
+
case Extensions.TsOnly:
|
|
43339
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43285
43340
|
switch (originalExtension) {
|
|
43286
43341
|
case ".mjs" /* Mjs */:
|
|
43287
43342
|
case ".mts" /* Mts */:
|
|
43288
43343
|
case ".d.mts" /* Dmts */:
|
|
43289
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43344
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43290
43345
|
case ".cjs" /* Cjs */:
|
|
43291
43346
|
case ".cts" /* Cts */:
|
|
43292
43347
|
case ".d.cts" /* Dcts */:
|
|
43293
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43348
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43294
43349
|
case ".json" /* Json */:
|
|
43295
43350
|
candidate += ".json" /* Json */;
|
|
43296
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43351
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43297
43352
|
default:
|
|
43298
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43353
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43299
43354
|
}
|
|
43300
43355
|
case Extensions.JavaScript:
|
|
43301
43356
|
switch (originalExtension) {
|
|
@@ -43522,6 +43577,7 @@ var ts;
|
|
|
43522
43577
|
switch (extensions) {
|
|
43523
43578
|
case Extensions.JavaScript:
|
|
43524
43579
|
case Extensions.Json:
|
|
43580
|
+
case Extensions.TsOnly:
|
|
43525
43581
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43526
43582
|
break;
|
|
43527
43583
|
case Extensions.TypeScript:
|
|
@@ -43594,14 +43650,16 @@ var ts;
|
|
|
43594
43650
|
function extensionIsOk(extensions, extension) {
|
|
43595
43651
|
switch (extensions) {
|
|
43596
43652
|
case Extensions.JavaScript:
|
|
43597
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43653
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43598
43654
|
case Extensions.TSConfig:
|
|
43599
43655
|
case Extensions.Json:
|
|
43600
43656
|
return extension === ".json" /* Json */;
|
|
43601
43657
|
case Extensions.TypeScript:
|
|
43602
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43658
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43659
|
+
case Extensions.TsOnly:
|
|
43660
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43603
43661
|
case Extensions.DtsOnly:
|
|
43604
|
-
return extension === ".d.ts" /* Dts */;
|
|
43662
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43605
43663
|
}
|
|
43606
43664
|
}
|
|
43607
43665
|
/* @internal */
|
|
@@ -45761,6 +45819,7 @@ var ts;
|
|
|
45761
45819
|
case 261 /* ModuleDeclaration */:
|
|
45762
45820
|
case 259 /* TypeAliasDeclaration */:
|
|
45763
45821
|
case 195 /* MappedType */:
|
|
45822
|
+
case 176 /* IndexSignature */:
|
|
45764
45823
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45765
45824
|
case 305 /* SourceFile */:
|
|
45766
45825
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45779,7 +45838,6 @@ var ts;
|
|
|
45779
45838
|
case 317 /* JSDocFunctionType */:
|
|
45780
45839
|
case 179 /* FunctionType */:
|
|
45781
45840
|
case 175 /* ConstructSignature */:
|
|
45782
|
-
case 176 /* IndexSignature */:
|
|
45783
45841
|
case 180 /* ConstructorType */:
|
|
45784
45842
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45785
45843
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50357,27 +50415,27 @@ var ts;
|
|
|
50357
50415
|
function resolveAlias(symbol) {
|
|
50358
50416
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50359
50417
|
var links = getSymbolLinks(symbol);
|
|
50360
|
-
if (!links.
|
|
50361
|
-
links.
|
|
50418
|
+
if (!links.aliasTarget) {
|
|
50419
|
+
links.aliasTarget = resolvingSymbol;
|
|
50362
50420
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50363
50421
|
if (!node)
|
|
50364
50422
|
return ts.Debug.fail();
|
|
50365
50423
|
var target = getTargetOfAliasDeclaration(node);
|
|
50366
|
-
if (links.
|
|
50367
|
-
links.
|
|
50424
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50425
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50368
50426
|
}
|
|
50369
50427
|
else {
|
|
50370
50428
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50371
50429
|
}
|
|
50372
50430
|
}
|
|
50373
|
-
else if (links.
|
|
50374
|
-
links.
|
|
50431
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50432
|
+
links.aliasTarget = unknownSymbol;
|
|
50375
50433
|
}
|
|
50376
|
-
return links.
|
|
50434
|
+
return links.aliasTarget;
|
|
50377
50435
|
}
|
|
50378
50436
|
function tryResolveAlias(symbol) {
|
|
50379
50437
|
var links = getSymbolLinks(symbol);
|
|
50380
|
-
if (links.
|
|
50438
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50381
50439
|
return resolveAlias(symbol);
|
|
50382
50440
|
}
|
|
50383
50441
|
return undefined;
|
|
@@ -52174,13 +52232,37 @@ var ts;
|
|
|
52174
52232
|
return ts.Debug.fail("Should be unreachable.");
|
|
52175
52233
|
function conditionalTypeToTypeNode(type) {
|
|
52176
52234
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52235
|
+
context.approximateLength += 15;
|
|
52236
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52237
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52238
|
+
var name = typeParameterToName(newParam, context);
|
|
52239
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52240
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52241
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52242
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52243
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52244
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52245
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52246
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52247
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52248
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52249
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52250
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52251
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52252
|
+
// this is potentially simplifiable to
|
|
52253
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52254
|
+
// but that may confuse users who read the output more.
|
|
52255
|
+
// On the other hand,
|
|
52256
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52257
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52258
|
+
return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
|
|
52259
|
+
}
|
|
52177
52260
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52178
52261
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52179
52262
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52180
52263
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52181
52264
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52182
52265
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52183
|
-
context.approximateLength += 15;
|
|
52184
52266
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52185
52267
|
}
|
|
52186
52268
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -52294,7 +52376,7 @@ var ts;
|
|
|
52294
52376
|
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
|
52295
52377
|
// of types allows us to catch circular references to instantiations of the same anonymous type
|
|
52296
52378
|
if (!context.visitedTypes) {
|
|
52297
|
-
context.visitedTypes = new ts.
|
|
52379
|
+
context.visitedTypes = new ts.Set();
|
|
52298
52380
|
}
|
|
52299
52381
|
if (id && !context.symbolDepth) {
|
|
52300
52382
|
context.symbolDepth = new ts.Map();
|
|
@@ -52312,22 +52394,15 @@ var ts;
|
|
|
52312
52394
|
context.approximateLength += cachedResult.addedLength;
|
|
52313
52395
|
return deepCloneOrReuseNode(cachedResult);
|
|
52314
52396
|
}
|
|
52315
|
-
var
|
|
52316
|
-
var symbolDepth = id ? context.symbolDepth.get(id) : undefined;
|
|
52317
|
-
if (symbolDepth) {
|
|
52318
|
-
totalDepth += symbolDepth;
|
|
52319
|
-
}
|
|
52320
|
-
var visitedTypeDepth = context.visitedTypes.get(typeId);
|
|
52321
|
-
if (visitedTypeDepth) {
|
|
52322
|
-
totalDepth += visitedTypeDepth;
|
|
52323
|
-
}
|
|
52324
|
-
if (totalDepth > 10) {
|
|
52325
|
-
return createElidedInformationPlaceholder(context);
|
|
52326
|
-
}
|
|
52397
|
+
var depth;
|
|
52327
52398
|
if (id) {
|
|
52328
|
-
context.symbolDepth.
|
|
52399
|
+
depth = context.symbolDepth.get(id) || 0;
|
|
52400
|
+
if (depth > 10) {
|
|
52401
|
+
return createElidedInformationPlaceholder(context);
|
|
52402
|
+
}
|
|
52403
|
+
context.symbolDepth.set(id, depth + 1);
|
|
52329
52404
|
}
|
|
52330
|
-
context.visitedTypes.
|
|
52405
|
+
context.visitedTypes.add(typeId);
|
|
52331
52406
|
var startLength = context.approximateLength;
|
|
52332
52407
|
var result = transform(type);
|
|
52333
52408
|
var addedLength = context.approximateLength - startLength;
|
|
@@ -52338,19 +52413,9 @@ var ts;
|
|
|
52338
52413
|
result.addedLength = addedLength;
|
|
52339
52414
|
(_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
52340
52415
|
}
|
|
52341
|
-
|
|
52342
|
-
context.visitedTypes.set(typeId, visitedTypeDepth);
|
|
52343
|
-
}
|
|
52344
|
-
else {
|
|
52345
|
-
context.visitedTypes.delete(typeId);
|
|
52346
|
-
}
|
|
52416
|
+
context.visitedTypes.delete(typeId);
|
|
52347
52417
|
if (id) {
|
|
52348
|
-
|
|
52349
|
-
context.symbolDepth.set(id, symbolDepth);
|
|
52350
|
-
}
|
|
52351
|
-
else {
|
|
52352
|
-
context.symbolDepth.delete(id);
|
|
52353
|
-
}
|
|
52418
|
+
context.symbolDepth.set(id, depth);
|
|
52354
52419
|
}
|
|
52355
52420
|
return result;
|
|
52356
52421
|
function deepCloneOrReuseNode(node) {
|
|
@@ -52896,9 +52961,6 @@ var ts;
|
|
|
52896
52961
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
52897
52962
|
parameterType = getOptionalType(parameterType);
|
|
52898
52963
|
}
|
|
52899
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
52900
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
52901
|
-
}
|
|
52902
52964
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
52903
52965
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
52904
52966
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53457,7 +53519,7 @@ var ts;
|
|
|
53457
53519
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53458
53520
|
// try to reuse the existing annotation
|
|
53459
53521
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53460
|
-
if (
|
|
53522
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53461
53523
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53462
53524
|
if (result_6) {
|
|
53463
53525
|
return result_6;
|
|
@@ -53474,6 +53536,16 @@ var ts;
|
|
|
53474
53536
|
context.flags = oldFlags;
|
|
53475
53537
|
return result;
|
|
53476
53538
|
}
|
|
53539
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53540
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53541
|
+
if (typeFromTypeNode === type) {
|
|
53542
|
+
return true;
|
|
53543
|
+
}
|
|
53544
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53545
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53546
|
+
}
|
|
53547
|
+
return false;
|
|
53548
|
+
}
|
|
53477
53549
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53478
53550
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53479
53551
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55745,7 +55817,7 @@ var ts;
|
|
|
55745
55817
|
}
|
|
55746
55818
|
}
|
|
55747
55819
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55748
|
-
type = getUnionType(sourceTypes
|
|
55820
|
+
type = getUnionType(sourceTypes);
|
|
55749
55821
|
}
|
|
55750
55822
|
}
|
|
55751
55823
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58494,8 +58566,9 @@ var ts;
|
|
|
58494
58566
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58495
58567
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58496
58568
|
// nesting, so it is effectively just a safety stop.
|
|
58497
|
-
|
|
58498
|
-
|
|
58569
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58570
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58571
|
+
stack.push(identity_1);
|
|
58499
58572
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58500
58573
|
stack.pop();
|
|
58501
58574
|
}
|
|
@@ -61851,11 +61924,14 @@ var ts;
|
|
|
61851
61924
|
return type[cache] = elementType;
|
|
61852
61925
|
}
|
|
61853
61926
|
}
|
|
61854
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
61855
|
-
//
|
|
61856
|
-
// construct the type Box<T[X]>.
|
|
61857
|
-
if (isGenericMappedType(objectType)
|
|
61858
|
-
|
|
61927
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
61928
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
61929
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
61930
|
+
if (isGenericMappedType(objectType)) {
|
|
61931
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
61932
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61933
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61934
|
+
}
|
|
61859
61935
|
}
|
|
61860
61936
|
return type[cache] = type;
|
|
61861
61937
|
}
|
|
@@ -66693,12 +66769,12 @@ var ts;
|
|
|
66693
66769
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66694
66770
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66695
66771
|
if (depth >= maxDepth) {
|
|
66696
|
-
var
|
|
66772
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66697
66773
|
var count = 0;
|
|
66698
66774
|
var lastTypeId = 0;
|
|
66699
66775
|
for (var i = 0; i < depth; i++) {
|
|
66700
66776
|
var t = stack[i];
|
|
66701
|
-
if (getRecursionIdentity(t) ===
|
|
66777
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66702
66778
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66703
66779
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66704
66780
|
if (t.id >= lastTypeId) {
|
|
@@ -74175,10 +74251,15 @@ var ts;
|
|
|
74175
74251
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74176
74252
|
}
|
|
74177
74253
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74254
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74255
|
+
// here even if `Foo` is not a const enum.
|
|
74256
|
+
//
|
|
74178
74257
|
// The exceptions are:
|
|
74179
74258
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74180
74259
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74181
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74260
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74261
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74262
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74182
74263
|
markAliasReferenced(parentSymbol, node);
|
|
74183
74264
|
}
|
|
74184
74265
|
var propType;
|
|
@@ -76700,7 +76781,7 @@ var ts;
|
|
|
76700
76781
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76701
76782
|
newSymbol.parent = originalSymbol;
|
|
76702
76783
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76703
|
-
newSymbol.
|
|
76784
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76704
76785
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76705
76786
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76706
76787
|
}
|
|
@@ -79512,19 +79593,28 @@ var ts;
|
|
|
79512
79593
|
if (constraintType && defaultType) {
|
|
79513
79594
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79514
79595
|
}
|
|
79515
|
-
|
|
79596
|
+
checkNodeDeferred(node);
|
|
79597
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79598
|
+
}
|
|
79599
|
+
function checkTypeParameterDeferred(node) {
|
|
79600
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79601
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79516
79602
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79517
|
-
if (modifiers
|
|
79603
|
+
if (modifiers) {
|
|
79518
79604
|
var symbol = getSymbolOfNode(node.parent);
|
|
79519
|
-
|
|
79520
|
-
|
|
79521
|
-
|
|
79522
|
-
|
|
79523
|
-
|
|
79524
|
-
|
|
79605
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79606
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79607
|
+
}
|
|
79608
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79609
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79610
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79611
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79612
|
+
varianceTypeParameter = typeParameter;
|
|
79613
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79614
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79615
|
+
}
|
|
79525
79616
|
}
|
|
79526
79617
|
}
|
|
79527
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79528
79618
|
}
|
|
79529
79619
|
function checkParameter(node) {
|
|
79530
79620
|
// Grammar checking
|
|
@@ -80014,7 +80104,7 @@ var ts;
|
|
|
80014
80104
|
superCallStatement = statement;
|
|
80015
80105
|
break;
|
|
80016
80106
|
}
|
|
80017
|
-
if (
|
|
80107
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80018
80108
|
break;
|
|
80019
80109
|
}
|
|
80020
80110
|
}
|
|
@@ -85367,6 +85457,9 @@ var ts;
|
|
|
85367
85457
|
case 226 /* ClassExpression */:
|
|
85368
85458
|
checkClassExpressionDeferred(node);
|
|
85369
85459
|
break;
|
|
85460
|
+
case 163 /* TypeParameter */:
|
|
85461
|
+
checkTypeParameterDeferred(node);
|
|
85462
|
+
break;
|
|
85370
85463
|
case 279 /* JsxSelfClosingElement */:
|
|
85371
85464
|
checkJsxSelfClosingElementDeferred(node);
|
|
85372
85465
|
break;
|
|
@@ -85901,15 +85994,20 @@ var ts;
|
|
|
85901
85994
|
return propertyDeclaration;
|
|
85902
85995
|
}
|
|
85903
85996
|
}
|
|
85904
|
-
else if (ts.isMetaProperty(parent)) {
|
|
85905
|
-
|
|
85906
|
-
|
|
85907
|
-
if (propertyDeclaration) {
|
|
85908
|
-
return propertyDeclaration;
|
|
85909
|
-
}
|
|
85910
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
85997
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
85998
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
85999
|
+
// `target` in `new.target`
|
|
85911
86000
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
85912
86001
|
}
|
|
86002
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86003
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86004
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86005
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86006
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86007
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86008
|
+
}
|
|
86009
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86010
|
+
return undefined;
|
|
85913
86011
|
}
|
|
85914
86012
|
}
|
|
85915
86013
|
switch (node.kind) {
|
|
@@ -86181,11 +86279,11 @@ var ts;
|
|
|
86181
86279
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86182
86280
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86183
86281
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86184
|
-
: ts.singleElementArray(
|
|
86282
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86185
86283
|
}
|
|
86186
86284
|
return undefined;
|
|
86187
86285
|
}
|
|
86188
|
-
function
|
|
86286
|
+
function tryGetTarget(symbol) {
|
|
86189
86287
|
var target;
|
|
86190
86288
|
var next = symbol;
|
|
86191
86289
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86415,7 +86513,7 @@ var ts;
|
|
|
86415
86513
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86416
86514
|
return true;
|
|
86417
86515
|
}
|
|
86418
|
-
var target = getSymbolLinks(symbol).
|
|
86516
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86419
86517
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86420
86518
|
target.flags & 111551 /* Value */ &&
|
|
86421
86519
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86463,11 +86561,6 @@ var ts;
|
|
|
86463
86561
|
!parameter.initializer &&
|
|
86464
86562
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86465
86563
|
}
|
|
86466
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86467
|
-
return !!strictNullChecks &&
|
|
86468
|
-
isOptionalParameter(parameter) &&
|
|
86469
|
-
!parameter.initializer;
|
|
86470
|
-
}
|
|
86471
86564
|
function isExpandoFunctionDeclaration(node) {
|
|
86472
86565
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86473
86566
|
if (!declaration) {
|
|
@@ -87384,8 +87477,7 @@ var ts;
|
|
|
87384
87477
|
case 144 /* OutKeyword */:
|
|
87385
87478
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87386
87479
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87387
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87388
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87480
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87389
87481
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87390
87482
|
}
|
|
87391
87483
|
if (flags & inOutFlag) {
|
|
@@ -92619,11 +92711,11 @@ var ts;
|
|
|
92619
92711
|
}
|
|
92620
92712
|
var statements = [];
|
|
92621
92713
|
resumeLexicalEnvironment();
|
|
92622
|
-
var
|
|
92623
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92714
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92715
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92624
92716
|
// If there was a super call, visit existing statements up to and including it
|
|
92625
92717
|
if (superStatementIndex >= 0) {
|
|
92626
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92718
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92627
92719
|
}
|
|
92628
92720
|
// Transform parameters into property assignments. Transforms this:
|
|
92629
92721
|
//
|
|
@@ -92642,12 +92734,12 @@ var ts;
|
|
|
92642
92734
|
if (superStatementIndex >= 0) {
|
|
92643
92735
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92644
92736
|
}
|
|
92645
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92737
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92646
92738
|
else {
|
|
92647
|
-
statements =
|
|
92739
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92648
92740
|
}
|
|
92649
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92650
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92741
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92742
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92651
92743
|
// End the lexical environment.
|
|
92652
92744
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92653
92745
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -94593,7 +94685,7 @@ var ts;
|
|
|
94593
94685
|
}
|
|
94594
94686
|
resumeLexicalEnvironment();
|
|
94595
94687
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94596
|
-
var
|
|
94688
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94597
94689
|
var prologueStatementCount = 0;
|
|
94598
94690
|
var superStatementIndex = -1;
|
|
94599
94691
|
var statements = [];
|
|
@@ -94602,8 +94694,11 @@ var ts;
|
|
|
94602
94694
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94603
94695
|
// If there was a super call, visit existing statements up to and including it
|
|
94604
94696
|
if (superStatementIndex >= 0) {
|
|
94605
|
-
|
|
94606
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94697
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94698
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
94699
|
+
}
|
|
94700
|
+
else if (prologueStatementCount >= 0) {
|
|
94701
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94607
94702
|
}
|
|
94608
94703
|
}
|
|
94609
94704
|
if (needsSyntheticConstructor) {
|
|
@@ -94639,22 +94734,20 @@ var ts;
|
|
|
94639
94734
|
}
|
|
94640
94735
|
}
|
|
94641
94736
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94642
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94737
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94643
94738
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94644
94739
|
if (superStatementIndex >= 0) {
|
|
94645
94740
|
ts.addRange(statements, parameterProperties);
|
|
94646
94741
|
}
|
|
94647
|
-
// If a synthetic super() call was added, add them just after it
|
|
94648
|
-
else if (needsSyntheticConstructor) {
|
|
94649
|
-
statements = __spreadArray(__spreadArray([
|
|
94650
|
-
statements[0]
|
|
94651
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94652
|
-
}
|
|
94653
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94654
94742
|
else {
|
|
94655
|
-
|
|
94743
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94744
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94745
|
+
// If a synthetic super() call was added, need to account for that
|
|
94746
|
+
if (needsSyntheticConstructor)
|
|
94747
|
+
superAndPrologueStatementCount++;
|
|
94748
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94656
94749
|
}
|
|
94657
|
-
|
|
94750
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94658
94751
|
}
|
|
94659
94752
|
}
|
|
94660
94753
|
}
|
|
@@ -94664,7 +94757,7 @@ var ts;
|
|
|
94664
94757
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94665
94758
|
// Add existing statements after the initial prologues and super call
|
|
94666
94759
|
if (constructor) {
|
|
94667
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94760
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94668
94761
|
}
|
|
94669
94762
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94670
94763
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -98705,7 +98798,7 @@ var ts;
|
|
|
98705
98798
|
// ```
|
|
98706
98799
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98707
98800
|
}
|
|
98708
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
98801
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98709
98802
|
/*location*/ constructor.body.statements),
|
|
98710
98803
|
/*multiLine*/ true);
|
|
98711
98804
|
ts.setTextRange(body, constructor.body);
|
|
@@ -108411,6 +108504,10 @@ var ts;
|
|
|
108411
108504
|
return factory.updateModifiers(statement, modifiers);
|
|
108412
108505
|
}
|
|
108413
108506
|
function transformTopLevelDeclaration(input) {
|
|
108507
|
+
if (lateMarkedStatements) {
|
|
108508
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108509
|
+
;
|
|
108510
|
+
}
|
|
108414
108511
|
if (shouldStripInternal(input))
|
|
108415
108512
|
return;
|
|
108416
108513
|
switch (input.kind) {
|
|
@@ -109542,7 +109639,7 @@ var ts;
|
|
|
109542
109639
|
addOutput(buildInfoPath);
|
|
109543
109640
|
}
|
|
109544
109641
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109545
|
-
if (ts.
|
|
109642
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109546
109643
|
return;
|
|
109547
109644
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109548
109645
|
addOutput(js);
|
|
@@ -109587,7 +109684,7 @@ var ts;
|
|
|
109587
109684
|
/*@internal*/
|
|
109588
109685
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109589
109686
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109590
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109687
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.isDeclarationFileName(file); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
109591
109688
|
}
|
|
109592
109689
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109593
109690
|
/*@internal*/
|
|
@@ -109629,7 +109726,7 @@ var ts;
|
|
|
109629
109726
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109630
109727
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109631
109728
|
var inputFileName = _b[_a];
|
|
109632
|
-
if (ts.
|
|
109729
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109633
109730
|
continue;
|
|
109634
109731
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109635
109732
|
if (jsFilePath)
|
|
@@ -114979,7 +115076,7 @@ var ts;
|
|
|
114979
115076
|
if (ts.outFile(options) || options.outDir)
|
|
114980
115077
|
return false;
|
|
114981
115078
|
// File if emitted next to input needs to be ignored
|
|
114982
|
-
if (ts.
|
|
115079
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
114983
115080
|
// If its declaration directory: its not ignored if not excluded by config
|
|
114984
115081
|
if (options.declarationDir)
|
|
114985
115082
|
return false;
|
|
@@ -116152,7 +116249,7 @@ var ts;
|
|
|
116152
116249
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116153
116250
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116154
116251
|
var fileName = _c[_b];
|
|
116155
|
-
if (!ts.
|
|
116252
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116156
116253
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116157
116254
|
}
|
|
116158
116255
|
}
|
|
@@ -116343,7 +116440,7 @@ var ts;
|
|
|
116343
116440
|
}
|
|
116344
116441
|
function getRedirectReferenceForResolution(file) {
|
|
116345
116442
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116346
|
-
if (redirect || !ts.
|
|
116443
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116347
116444
|
return redirect;
|
|
116348
116445
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116349
116446
|
// So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case
|
|
@@ -117734,7 +117831,7 @@ var ts;
|
|
|
117734
117831
|
}
|
|
117735
117832
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117736
117833
|
// Ignore dts or any json files
|
|
117737
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
117834
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117738
117835
|
return undefined;
|
|
117739
117836
|
}
|
|
117740
117837
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117783,7 +117880,7 @@ var ts;
|
|
|
117783
117880
|
else {
|
|
117784
117881
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117785
117882
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117786
|
-
if (!ts.
|
|
117883
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117787
117884
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117788
117885
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117789
117886
|
}
|
|
@@ -118584,7 +118681,7 @@ var ts;
|
|
|
118584
118681
|
if (options.outDir) {
|
|
118585
118682
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118586
118683
|
}
|
|
118587
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118684
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118588
118685
|
// Otherwise just check if sourceFile with the name exists
|
|
118589
118686
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118590
118687
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -118917,13 +119014,9 @@ var ts;
|
|
|
118917
119014
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
118918
119015
|
var BuilderState;
|
|
118919
119016
|
(function (BuilderState) {
|
|
118920
|
-
var manyToManyPathMapCount = 0;
|
|
118921
119017
|
function createManyToManyPathMap() {
|
|
118922
119018
|
function create(forward, reverse, deleted) {
|
|
118923
|
-
var version = 0;
|
|
118924
119019
|
var map = {
|
|
118925
|
-
id: manyToManyPathMapCount++,
|
|
118926
|
-
version: function () { return version; },
|
|
118927
119020
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
118928
119021
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
118929
119022
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -118939,30 +119032,29 @@ var ts;
|
|
|
118939
119032
|
}
|
|
118940
119033
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
118941
119034
|
forward.delete(k);
|
|
118942
|
-
version++;
|
|
118943
119035
|
return true;
|
|
118944
119036
|
},
|
|
118945
119037
|
set: function (k, vSet) {
|
|
118946
|
-
|
|
119038
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
118947
119039
|
var existingVSet = forward.get(k);
|
|
118948
119040
|
forward.set(k, vSet);
|
|
118949
119041
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
118950
119042
|
if (!vSet.has(v)) {
|
|
118951
|
-
changed = true;
|
|
118952
119043
|
deleteFromMultimap(reverse, v, k);
|
|
118953
119044
|
}
|
|
118954
119045
|
});
|
|
118955
119046
|
vSet.forEach(function (v) {
|
|
118956
119047
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
118957
|
-
changed = true;
|
|
118958
119048
|
addToMultimap(reverse, v, k);
|
|
118959
119049
|
}
|
|
118960
119050
|
});
|
|
118961
|
-
if (changed) {
|
|
118962
|
-
version++;
|
|
118963
|
-
}
|
|
118964
119051
|
return map;
|
|
118965
119052
|
},
|
|
119053
|
+
clear: function () {
|
|
119054
|
+
forward.clear();
|
|
119055
|
+
reverse.clear();
|
|
119056
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119057
|
+
}
|
|
118966
119058
|
};
|
|
118967
119059
|
return map;
|
|
118968
119060
|
}
|
|
@@ -118977,11 +119069,10 @@ var ts;
|
|
|
118977
119069
|
}
|
|
118978
119070
|
set.add(v);
|
|
118979
119071
|
}
|
|
118980
|
-
function deleteFromMultimap(map, k, v
|
|
118981
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119072
|
+
function deleteFromMultimap(map, k, v) {
|
|
118982
119073
|
var set = map.get(k);
|
|
118983
119074
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
118984
|
-
if (
|
|
119075
|
+
if (!set.size) {
|
|
118985
119076
|
map.delete(k);
|
|
118986
119077
|
}
|
|
118987
119078
|
return true;
|
|
@@ -119210,7 +119301,7 @@ var ts;
|
|
|
119210
119301
|
/*forceDtsEmit*/ true);
|
|
119211
119302
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119212
119303
|
if (firstDts_1) {
|
|
119213
|
-
ts.Debug.assert(ts.
|
|
119304
|
+
ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
119214
119305
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119215
119306
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119216
119307
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119268,20 +119359,6 @@ var ts;
|
|
|
119268
119359
|
var _a;
|
|
119269
119360
|
if (exportedModulesMapCache) {
|
|
119270
119361
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119271
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119272
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119273
|
-
if (state.previousCache) {
|
|
119274
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119275
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119276
|
-
// was updated, there's no need to update again
|
|
119277
|
-
return;
|
|
119278
|
-
}
|
|
119279
|
-
state.previousCache.id = cacheId;
|
|
119280
|
-
state.previousCache.version = cacheVersion;
|
|
119281
|
-
}
|
|
119282
|
-
else {
|
|
119283
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119284
|
-
}
|
|
119285
119362
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119286
119363
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119287
119364
|
}
|
|
@@ -119615,7 +119692,8 @@ var ts;
|
|
|
119615
119692
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119616
119693
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119617
119694
|
*/
|
|
119618
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119695
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119696
|
+
var _a;
|
|
119619
119697
|
while (true) {
|
|
119620
119698
|
var affectedFiles = state.affectedFiles;
|
|
119621
119699
|
if (affectedFiles) {
|
|
@@ -119626,7 +119704,7 @@ var ts;
|
|
|
119626
119704
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119627
119705
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119628
119706
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119629
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119707
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119630
119708
|
return affectedFile;
|
|
119631
119709
|
}
|
|
119632
119710
|
affectedFilesIndex++;
|
|
@@ -119638,6 +119716,7 @@ var ts;
|
|
|
119638
119716
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119639
119717
|
state.currentAffectedFilesSignatures.clear();
|
|
119640
119718
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119719
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119641
119720
|
state.affectedFiles = undefined;
|
|
119642
119721
|
}
|
|
119643
119722
|
// Get next changed file
|
|
@@ -119667,6 +119746,11 @@ var ts;
|
|
|
119667
119746
|
state.seenAffectedFiles = new ts.Set();
|
|
119668
119747
|
}
|
|
119669
119748
|
}
|
|
119749
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119750
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119751
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119752
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119753
|
+
}
|
|
119670
119754
|
/**
|
|
119671
119755
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119672
119756
|
*/
|
|
@@ -119686,9 +119770,7 @@ var ts;
|
|
|
119686
119770
|
}
|
|
119687
119771
|
}
|
|
119688
119772
|
}
|
|
119689
|
-
state
|
|
119690
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119691
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119773
|
+
clearAffectedFilesPendingEmit(state);
|
|
119692
119774
|
}
|
|
119693
119775
|
return undefined;
|
|
119694
119776
|
}
|
|
@@ -119696,7 +119778,7 @@ var ts;
|
|
|
119696
119778
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119697
119779
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119698
119780
|
*/
|
|
119699
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119781
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119700
119782
|
var _a;
|
|
119701
119783
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119702
119784
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119721,14 +119803,14 @@ var ts;
|
|
|
119721
119803
|
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
119722
119804
|
}
|
|
119723
119805
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119724
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119806
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119725
119807
|
}
|
|
119726
119808
|
}
|
|
119727
119809
|
/**
|
|
119728
119810
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119729
119811
|
* Also we need to make sure signature is updated for these files
|
|
119730
119812
|
*/
|
|
119731
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
119813
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119732
119814
|
removeSemanticDiagnosticsOf(state, path);
|
|
119733
119815
|
if (!state.changedFilesSet.has(path)) {
|
|
119734
119816
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119739,8 +119821,7 @@ var ts;
|
|
|
119739
119821
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119740
119822
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119741
119823
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119742
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119743
|
-
/* useFileVersionAsSignature */ true);
|
|
119824
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119744
119825
|
// If not dts emit, nothing more to do
|
|
119745
119826
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119746
119827
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -119937,13 +120018,18 @@ var ts;
|
|
|
119937
120018
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
119938
120019
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
119939
120020
|
return value.version === actualSignature ?
|
|
119940
|
-
value.affectsGlobalScope ?
|
|
119941
|
-
|
|
120021
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120022
|
+
// If file version is same as signature, dont serialize signature
|
|
120023
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120024
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
119942
120025
|
value.version :
|
|
119943
|
-
actualSignature !== undefined ?
|
|
120026
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
119944
120027
|
signature === undefined ?
|
|
120028
|
+
// If we havent computed signature, use fileInfo as is
|
|
119945
120029
|
value :
|
|
120030
|
+
// Serialize fileInfo with new updated signature
|
|
119946
120031
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120032
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
119947
120033
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
119948
120034
|
});
|
|
119949
120035
|
var referencedMap;
|
|
@@ -120188,7 +120274,7 @@ var ts;
|
|
|
120188
120274
|
* in that order would be used to write the files
|
|
120189
120275
|
*/
|
|
120190
120276
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120191
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120277
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120192
120278
|
var emitKind = 1 /* Full */;
|
|
120193
120279
|
var isPendingEmitFile = false;
|
|
120194
120280
|
if (!affected) {
|
|
@@ -120233,54 +120319,48 @@ var ts;
|
|
|
120233
120319
|
* in that order would be used to write the files
|
|
120234
120320
|
*/
|
|
120235
120321
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120236
|
-
var
|
|
120237
|
-
var savedAffectedFilesPendingEmit;
|
|
120238
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120239
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120240
|
-
// Backup and restore affected pendings emit state for non emit Builder if noEmitOnError is enabled and emitBuildInfo could be written in case there are errors
|
|
120241
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120242
|
-
// Note that when there are no errors, emit proceeds as if everything is emitted as it is callers reponsibility to write the files to disk if at all (because its builder that doesnt track files to emit)
|
|
120243
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120244
|
-
!targetSourceFile &&
|
|
120245
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120246
|
-
!state.compilerOptions.noEmit &&
|
|
120247
|
-
state.compilerOptions.noEmitOnError) {
|
|
120248
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120249
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120250
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120251
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120252
|
-
}
|
|
120322
|
+
var _a;
|
|
120253
120323
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120254
120324
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120255
120325
|
}
|
|
120256
120326
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120257
120327
|
if (result)
|
|
120258
120328
|
return result;
|
|
120259
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120260
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120261
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120262
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120263
|
-
}
|
|
120264
120329
|
// Emit only affected files if using builder for emit
|
|
120265
|
-
if (!targetSourceFile
|
|
120266
|
-
|
|
120267
|
-
|
|
120268
|
-
|
|
120269
|
-
|
|
120270
|
-
|
|
120271
|
-
|
|
120272
|
-
|
|
120273
|
-
|
|
120274
|
-
|
|
120275
|
-
|
|
120276
|
-
|
|
120330
|
+
if (!targetSourceFile) {
|
|
120331
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120332
|
+
// Emit and report any errors we ran into.
|
|
120333
|
+
var sourceMaps = [];
|
|
120334
|
+
var emitSkipped = false;
|
|
120335
|
+
var diagnostics = void 0;
|
|
120336
|
+
var emittedFiles = [];
|
|
120337
|
+
var affectedEmitResult = void 0;
|
|
120338
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120339
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120340
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120341
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120342
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120343
|
+
}
|
|
120344
|
+
return {
|
|
120345
|
+
emitSkipped: emitSkipped,
|
|
120346
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120347
|
+
emittedFiles: emittedFiles,
|
|
120348
|
+
sourceMaps: sourceMaps
|
|
120349
|
+
};
|
|
120350
|
+
}
|
|
120351
|
+
// In non Emit builder, clear affected files pending emit
|
|
120352
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120353
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120354
|
+
// State can clear affected files pending emit if
|
|
120355
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120356
|
+
// If every file pending emit is pending on only dts emit
|
|
120357
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120358
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120359
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120360
|
+
})) {
|
|
120361
|
+
clearAffectedFilesPendingEmit(state);
|
|
120362
|
+
}
|
|
120277
120363
|
}
|
|
120278
|
-
return {
|
|
120279
|
-
emitSkipped: emitSkipped,
|
|
120280
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120281
|
-
emittedFiles: emittedFiles,
|
|
120282
|
-
sourceMaps: sourceMaps
|
|
120283
|
-
};
|
|
120284
120364
|
}
|
|
120285
120365
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120286
120366
|
}
|
|
@@ -120290,7 +120370,7 @@ var ts;
|
|
|
120290
120370
|
*/
|
|
120291
120371
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120292
120372
|
while (true) {
|
|
120293
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120373
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120294
120374
|
if (!affected) {
|
|
120295
120375
|
// Done
|
|
120296
120376
|
return undefined;
|
|
@@ -123410,9 +123490,6 @@ var ts;
|
|
|
123410
123490
|
function newer(date1, date2) {
|
|
123411
123491
|
return date2 > date1 ? date2 : date1;
|
|
123412
123492
|
}
|
|
123413
|
-
function isDeclarationFile(fileName) {
|
|
123414
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123415
|
-
}
|
|
123416
123493
|
/*@internal*/
|
|
123417
123494
|
function isCircularBuildOrder(buildOrder) {
|
|
123418
123495
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -123975,7 +124052,7 @@ var ts;
|
|
|
123975
124052
|
outputFiles.forEach(function (_a) {
|
|
123976
124053
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
123977
124054
|
var priorChangeTime;
|
|
123978
|
-
if (!anyDtsChanged &&
|
|
124055
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
123979
124056
|
// Check for unchanged .d.ts files
|
|
123980
124057
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
123981
124058
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124316,7 +124393,7 @@ var ts;
|
|
|
124316
124393
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124317
124394
|
// had its file touched but not had its contents changed - this allows us
|
|
124318
124395
|
// to skip a downstream typecheck
|
|
124319
|
-
if (
|
|
124396
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124320
124397
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124321
124398
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124322
124399
|
}
|
|
@@ -124470,7 +124547,7 @@ var ts;
|
|
|
124470
124547
|
reportVerbose = false;
|
|
124471
124548
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124472
124549
|
}
|
|
124473
|
-
if (
|
|
124550
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124474
124551
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124475
124552
|
}
|
|
124476
124553
|
host.setModifiedTime(file, now);
|