typescript 4.7.0-dev.20220406 → 4.7.0-dev.20220416
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 +252 -186
- package/lib/tsserver.js +703 -309
- package/lib/tsserverlibrary.d.ts +7 -2
- package/lib/tsserverlibrary.js +703 -309
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +462 -289
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +462 -289
- package/lib/typingsInstaller.js +285 -206
- 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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220416";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -4660,7 +4660,6 @@ var ts;
|
|
|
4660
4660
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4661
4661
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4662
4662
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4663
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4664
4663
|
// Error handling
|
|
4665
4664
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4666
4665
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8717,6 +8716,7 @@ var ts;
|
|
|
8717
8716
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8718
8717
|
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."),
|
|
8719
8718
|
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."),
|
|
8719
|
+
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."),
|
|
8720
8720
|
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."),
|
|
8721
8721
|
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."),
|
|
8722
8722
|
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."),
|
|
@@ -14965,6 +14965,10 @@ var ts;
|
|
|
14965
14965
|
}
|
|
14966
14966
|
}
|
|
14967
14967
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14968
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14969
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14970
|
+
}
|
|
14971
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14968
14972
|
function isLateVisibilityPaintedStatement(node) {
|
|
14969
14973
|
switch (node.kind) {
|
|
14970
14974
|
case 266 /* ImportDeclaration */:
|
|
@@ -16325,17 +16329,13 @@ var ts;
|
|
|
16325
16329
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16326
16330
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16327
16331
|
}
|
|
16328
|
-
if (ts.
|
|
16332
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16329
16333
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16330
16334
|
ts.isIdentifier(initializer.expression) &&
|
|
16331
16335
|
(initializer.expression.escapedText === "window" ||
|
|
16332
16336
|
initializer.expression.escapedText === "self" ||
|
|
16333
16337
|
initializer.expression.escapedText === "global"))) {
|
|
16334
|
-
|
|
16335
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16336
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16337
|
-
}
|
|
16338
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16338
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16339
16339
|
}
|
|
16340
16340
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16341
16341
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16543,14 +16543,14 @@ var ts;
|
|
|
16543
16543
|
}
|
|
16544
16544
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16545
16545
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16546
|
-
var _a, _b
|
|
16546
|
+
var _a, _b;
|
|
16547
16547
|
switch (node.kind) {
|
|
16548
16548
|
case 254 /* VariableDeclaration */:
|
|
16549
|
-
return node.initializer.arguments[0]
|
|
16549
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16550
16550
|
case 266 /* ImportDeclaration */:
|
|
16551
|
-
return
|
|
16551
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16552
16552
|
case 265 /* ImportEqualsDeclaration */:
|
|
16553
|
-
return
|
|
16553
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16554
16554
|
default:
|
|
16555
16555
|
ts.Debug.assertNever(node);
|
|
16556
16556
|
}
|
|
@@ -17065,7 +17065,10 @@ var ts;
|
|
|
17065
17065
|
return parent.propertyName === node;
|
|
17066
17066
|
case 275 /* ExportSpecifier */:
|
|
17067
17067
|
case 285 /* JsxAttribute */:
|
|
17068
|
-
|
|
17068
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17069
|
+
case 280 /* JsxOpeningElement */:
|
|
17070
|
+
case 281 /* JsxClosingElement */:
|
|
17071
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17069
17072
|
return true;
|
|
17070
17073
|
}
|
|
17071
17074
|
return false;
|
|
@@ -17081,21 +17084,28 @@ var ts;
|
|
|
17081
17084
|
// export = <EntityNameExpression>
|
|
17082
17085
|
// export default <EntityNameExpression>
|
|
17083
17086
|
// module.exports = <EntityNameExpression>
|
|
17084
|
-
//
|
|
17085
|
-
//
|
|
17087
|
+
// module.exports.x = <EntityNameExpression>
|
|
17088
|
+
// const x = require("...")
|
|
17089
|
+
// const { x } = require("...")
|
|
17090
|
+
// const x = require("...").y
|
|
17091
|
+
// const { x } = require("...").y
|
|
17086
17092
|
function isAliasSymbolDeclaration(node) {
|
|
17087
|
-
|
|
17093
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17088
17094
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17089
17095
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17090
17096
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17091
17097
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17092
17098
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17093
17099
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17094
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17100
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17101
|
+
return true;
|
|
17102
|
+
}
|
|
17103
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17104
|
+
ts.isPropertyAccessExpression(node)
|
|
17105
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17106
|
+
&& node.parent.left === node
|
|
17107
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17108
|
+
&& isAliasableExpression(node.parent.right));
|
|
17099
17109
|
}
|
|
17100
17110
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17101
17111
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17106,6 +17116,7 @@ var ts;
|
|
|
17106
17116
|
case 275 /* ExportSpecifier */:
|
|
17107
17117
|
case 271 /* ExportAssignment */:
|
|
17108
17118
|
case 265 /* ImportEqualsDeclaration */:
|
|
17119
|
+
case 274 /* NamespaceExport */:
|
|
17109
17120
|
return node.parent;
|
|
17110
17121
|
case 161 /* QualifiedName */:
|
|
17111
17122
|
do {
|
|
@@ -18932,6 +18943,11 @@ var ts;
|
|
|
18932
18943
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
18933
18944
|
}
|
|
18934
18945
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
18946
|
+
function isRightSideOfAccessExpression(node) {
|
|
18947
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
18948
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
18949
|
+
}
|
|
18950
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
18935
18951
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
18936
18952
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
18937
18953
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19583,6 +19599,41 @@ var ts;
|
|
|
19583
19599
|
return expr;
|
|
19584
19600
|
}
|
|
19585
19601
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19602
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19603
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19604
|
+
return walkAccessExpression(name.parent);
|
|
19605
|
+
}
|
|
19606
|
+
function walkAccessExpression(access) {
|
|
19607
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19608
|
+
var res = action(access.name);
|
|
19609
|
+
if (res !== undefined) {
|
|
19610
|
+
return res;
|
|
19611
|
+
}
|
|
19612
|
+
}
|
|
19613
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19614
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19615
|
+
var res = action(access.argumentExpression);
|
|
19616
|
+
if (res !== undefined) {
|
|
19617
|
+
return res;
|
|
19618
|
+
}
|
|
19619
|
+
}
|
|
19620
|
+
else {
|
|
19621
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19622
|
+
return undefined;
|
|
19623
|
+
}
|
|
19624
|
+
}
|
|
19625
|
+
if (isAccessExpression(access.expression)) {
|
|
19626
|
+
return walkAccessExpression(access.expression);
|
|
19627
|
+
}
|
|
19628
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19629
|
+
// End of chain at Identifier 'x.y.z'
|
|
19630
|
+
return action(access.expression);
|
|
19631
|
+
}
|
|
19632
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19633
|
+
return undefined;
|
|
19634
|
+
}
|
|
19635
|
+
}
|
|
19636
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19586
19637
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19587
19638
|
while (true) {
|
|
19588
19639
|
switch (node.kind) {
|
|
@@ -20530,6 +20581,7 @@ var ts;
|
|
|
20530
20581
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20531
20582
|
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 */]];
|
|
20532
20583
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20584
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20533
20585
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20534
20586
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20535
20587
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21218,6 +21270,11 @@ var ts;
|
|
|
21218
21270
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21219
21271
|
}
|
|
21220
21272
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21273
|
+
function getParameterTypeNode(parameter) {
|
|
21274
|
+
var _a;
|
|
21275
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21276
|
+
}
|
|
21277
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21221
21278
|
})(ts || (ts = {}));
|
|
21222
21279
|
/* @internal */
|
|
21223
21280
|
var ts;
|
|
@@ -35371,34 +35428,10 @@ var ts;
|
|
|
35371
35428
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35372
35429
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35373
35430
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35374
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35375
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35376
|
-
// expression.
|
|
35377
|
-
// falls through
|
|
35378
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35379
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35380
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35381
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35382
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35383
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35384
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35385
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35386
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35387
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35388
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35389
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35390
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35391
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35392
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35393
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35394
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35395
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35396
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35397
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35398
35431
|
return true;
|
|
35399
35432
|
}
|
|
35400
|
-
//
|
|
35401
|
-
return
|
|
35433
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35434
|
+
return !isStartOfExpression();
|
|
35402
35435
|
}
|
|
35403
35436
|
function parsePrimaryExpression() {
|
|
35404
35437
|
switch (token()) {
|
|
@@ -38616,7 +38649,7 @@ var ts;
|
|
|
38616
38649
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38617
38650
|
/** @internal */
|
|
38618
38651
|
function isDeclarationFileName(fileName) {
|
|
38619
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38652
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38620
38653
|
}
|
|
38621
38654
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38622
38655
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42124,7 +42157,8 @@ var ts;
|
|
|
42124
42157
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42125
42158
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42126
42159
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42127
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42160
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42161
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42128
42162
|
})(Extensions || (Extensions = {}));
|
|
42129
42163
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42130
42164
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43069,7 +43103,21 @@ var ts;
|
|
|
43069
43103
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43070
43104
|
}
|
|
43071
43105
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43072
|
-
|
|
43106
|
+
var extensions;
|
|
43107
|
+
if (lookupConfig) {
|
|
43108
|
+
extensions = tsconfigExtensions;
|
|
43109
|
+
}
|
|
43110
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43111
|
+
extensions = [Extensions.TsOnly];
|
|
43112
|
+
if (compilerOptions.allowJs)
|
|
43113
|
+
extensions.push(Extensions.JavaScript);
|
|
43114
|
+
if (compilerOptions.resolveJsonModule)
|
|
43115
|
+
extensions.push(Extensions.Json);
|
|
43116
|
+
}
|
|
43117
|
+
else {
|
|
43118
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43119
|
+
}
|
|
43120
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43073
43121
|
}
|
|
43074
43122
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43075
43123
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43078,6 +43126,10 @@ var ts;
|
|
|
43078
43126
|
var failedLookupLocations = [];
|
|
43079
43127
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43080
43128
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43129
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43130
|
+
if (compilerOptions.noDtsResolution) {
|
|
43131
|
+
conditions.pop();
|
|
43132
|
+
}
|
|
43081
43133
|
var state = {
|
|
43082
43134
|
compilerOptions: compilerOptions,
|
|
43083
43135
|
host: host,
|
|
@@ -43085,7 +43137,7 @@ var ts;
|
|
|
43085
43137
|
failedLookupLocations: failedLookupLocations,
|
|
43086
43138
|
packageJsonInfoCache: cache,
|
|
43087
43139
|
features: features,
|
|
43088
|
-
conditions:
|
|
43140
|
+
conditions: conditions,
|
|
43089
43141
|
};
|
|
43090
43142
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43091
43143
|
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);
|
|
@@ -43261,9 +43313,9 @@ var ts;
|
|
|
43261
43313
|
}
|
|
43262
43314
|
}
|
|
43263
43315
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43264
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43316
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43265
43317
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43266
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43318
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43267
43319
|
}
|
|
43268
43320
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43269
43321
|
}
|
|
@@ -43293,20 +43345,22 @@ var ts;
|
|
|
43293
43345
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43294
43346
|
}
|
|
43295
43347
|
case Extensions.TypeScript:
|
|
43348
|
+
case Extensions.TsOnly:
|
|
43349
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43296
43350
|
switch (originalExtension) {
|
|
43297
43351
|
case ".mjs" /* Mjs */:
|
|
43298
43352
|
case ".mts" /* Mts */:
|
|
43299
43353
|
case ".d.mts" /* Dmts */:
|
|
43300
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43354
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43301
43355
|
case ".cjs" /* Cjs */:
|
|
43302
43356
|
case ".cts" /* Cts */:
|
|
43303
43357
|
case ".d.cts" /* Dcts */:
|
|
43304
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43358
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43305
43359
|
case ".json" /* Json */:
|
|
43306
43360
|
candidate += ".json" /* Json */;
|
|
43307
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43361
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43308
43362
|
default:
|
|
43309
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43363
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43310
43364
|
}
|
|
43311
43365
|
case Extensions.JavaScript:
|
|
43312
43366
|
switch (originalExtension) {
|
|
@@ -43533,6 +43587,7 @@ var ts;
|
|
|
43533
43587
|
switch (extensions) {
|
|
43534
43588
|
case Extensions.JavaScript:
|
|
43535
43589
|
case Extensions.Json:
|
|
43590
|
+
case Extensions.TsOnly:
|
|
43536
43591
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43537
43592
|
break;
|
|
43538
43593
|
case Extensions.TypeScript:
|
|
@@ -43605,14 +43660,16 @@ var ts;
|
|
|
43605
43660
|
function extensionIsOk(extensions, extension) {
|
|
43606
43661
|
switch (extensions) {
|
|
43607
43662
|
case Extensions.JavaScript:
|
|
43608
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43663
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43609
43664
|
case Extensions.TSConfig:
|
|
43610
43665
|
case Extensions.Json:
|
|
43611
43666
|
return extension === ".json" /* Json */;
|
|
43612
43667
|
case Extensions.TypeScript:
|
|
43613
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43668
|
+
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 */;
|
|
43669
|
+
case Extensions.TsOnly:
|
|
43670
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43614
43671
|
case Extensions.DtsOnly:
|
|
43615
|
-
return extension === ".d.ts" /* Dts */;
|
|
43672
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43616
43673
|
}
|
|
43617
43674
|
}
|
|
43618
43675
|
/* @internal */
|
|
@@ -45772,6 +45829,7 @@ var ts;
|
|
|
45772
45829
|
case 261 /* ModuleDeclaration */:
|
|
45773
45830
|
case 259 /* TypeAliasDeclaration */:
|
|
45774
45831
|
case 195 /* MappedType */:
|
|
45832
|
+
case 176 /* IndexSignature */:
|
|
45775
45833
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45776
45834
|
case 305 /* SourceFile */:
|
|
45777
45835
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45790,7 +45848,6 @@ var ts;
|
|
|
45790
45848
|
case 317 /* JSDocFunctionType */:
|
|
45791
45849
|
case 179 /* FunctionType */:
|
|
45792
45850
|
case 175 /* ConstructSignature */:
|
|
45793
|
-
case 176 /* IndexSignature */:
|
|
45794
45851
|
case 180 /* ConstructorType */:
|
|
45795
45852
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45796
45853
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50368,27 +50425,27 @@ var ts;
|
|
|
50368
50425
|
function resolveAlias(symbol) {
|
|
50369
50426
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50370
50427
|
var links = getSymbolLinks(symbol);
|
|
50371
|
-
if (!links.
|
|
50372
|
-
links.
|
|
50428
|
+
if (!links.aliasTarget) {
|
|
50429
|
+
links.aliasTarget = resolvingSymbol;
|
|
50373
50430
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50374
50431
|
if (!node)
|
|
50375
50432
|
return ts.Debug.fail();
|
|
50376
50433
|
var target = getTargetOfAliasDeclaration(node);
|
|
50377
|
-
if (links.
|
|
50378
|
-
links.
|
|
50434
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50435
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50379
50436
|
}
|
|
50380
50437
|
else {
|
|
50381
50438
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50382
50439
|
}
|
|
50383
50440
|
}
|
|
50384
|
-
else if (links.
|
|
50385
|
-
links.
|
|
50441
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50442
|
+
links.aliasTarget = unknownSymbol;
|
|
50386
50443
|
}
|
|
50387
|
-
return links.
|
|
50444
|
+
return links.aliasTarget;
|
|
50388
50445
|
}
|
|
50389
50446
|
function tryResolveAlias(symbol) {
|
|
50390
50447
|
var links = getSymbolLinks(symbol);
|
|
50391
|
-
if (links.
|
|
50448
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50392
50449
|
return resolveAlias(symbol);
|
|
50393
50450
|
}
|
|
50394
50451
|
return undefined;
|
|
@@ -52185,13 +52242,37 @@ var ts;
|
|
|
52185
52242
|
return ts.Debug.fail("Should be unreachable.");
|
|
52186
52243
|
function conditionalTypeToTypeNode(type) {
|
|
52187
52244
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52245
|
+
context.approximateLength += 15;
|
|
52246
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52247
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52248
|
+
var name = typeParameterToName(newParam, context);
|
|
52249
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52250
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52251
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52252
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52253
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52254
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52255
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52256
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52257
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52258
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52259
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52260
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52261
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52262
|
+
// this is potentially simplifiable to
|
|
52263
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52264
|
+
// but that may confuse users who read the output more.
|
|
52265
|
+
// On the other hand,
|
|
52266
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52267
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52268
|
+
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 */));
|
|
52269
|
+
}
|
|
52188
52270
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52189
52271
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52190
52272
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52191
52273
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52192
52274
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52193
52275
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52194
|
-
context.approximateLength += 15;
|
|
52195
52276
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52196
52277
|
}
|
|
52197
52278
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -52890,9 +52971,6 @@ var ts;
|
|
|
52890
52971
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
52891
52972
|
parameterType = getOptionalType(parameterType);
|
|
52892
52973
|
}
|
|
52893
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
52894
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
52895
|
-
}
|
|
52896
52974
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
52897
52975
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
52898
52976
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53451,7 +53529,7 @@ var ts;
|
|
|
53451
53529
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53452
53530
|
// try to reuse the existing annotation
|
|
53453
53531
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53454
|
-
if (
|
|
53532
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53455
53533
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53456
53534
|
if (result_6) {
|
|
53457
53535
|
return result_6;
|
|
@@ -53468,6 +53546,16 @@ var ts;
|
|
|
53468
53546
|
context.flags = oldFlags;
|
|
53469
53547
|
return result;
|
|
53470
53548
|
}
|
|
53549
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53550
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53551
|
+
if (typeFromTypeNode === type) {
|
|
53552
|
+
return true;
|
|
53553
|
+
}
|
|
53554
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53555
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53556
|
+
}
|
|
53557
|
+
return false;
|
|
53558
|
+
}
|
|
53471
53559
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53472
53560
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53473
53561
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55739,7 +55827,7 @@ var ts;
|
|
|
55739
55827
|
}
|
|
55740
55828
|
}
|
|
55741
55829
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55742
|
-
type = getUnionType(sourceTypes
|
|
55830
|
+
type = getUnionType(sourceTypes);
|
|
55743
55831
|
}
|
|
55744
55832
|
}
|
|
55745
55833
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58488,8 +58576,9 @@ var ts;
|
|
|
58488
58576
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58489
58577
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58490
58578
|
// nesting, so it is effectively just a safety stop.
|
|
58491
|
-
|
|
58492
|
-
|
|
58579
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58580
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58581
|
+
stack.push(identity_1);
|
|
58493
58582
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58494
58583
|
stack.pop();
|
|
58495
58584
|
}
|
|
@@ -66687,12 +66776,12 @@ var ts;
|
|
|
66687
66776
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66688
66777
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66689
66778
|
if (depth >= maxDepth) {
|
|
66690
|
-
var
|
|
66779
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66691
66780
|
var count = 0;
|
|
66692
66781
|
var lastTypeId = 0;
|
|
66693
66782
|
for (var i = 0; i < depth; i++) {
|
|
66694
66783
|
var t = stack[i];
|
|
66695
|
-
if (getRecursionIdentity(t) ===
|
|
66784
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66696
66785
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66697
66786
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66698
66787
|
if (t.id >= lastTypeId) {
|
|
@@ -76694,7 +76783,7 @@ var ts;
|
|
|
76694
76783
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76695
76784
|
newSymbol.parent = originalSymbol;
|
|
76696
76785
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76697
|
-
newSymbol.
|
|
76786
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76698
76787
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76699
76788
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76700
76789
|
}
|
|
@@ -79506,19 +79595,28 @@ var ts;
|
|
|
79506
79595
|
if (constraintType && defaultType) {
|
|
79507
79596
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79508
79597
|
}
|
|
79509
|
-
|
|
79598
|
+
checkNodeDeferred(node);
|
|
79599
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79600
|
+
}
|
|
79601
|
+
function checkTypeParameterDeferred(node) {
|
|
79602
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79603
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79510
79604
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79511
|
-
if (modifiers
|
|
79605
|
+
if (modifiers) {
|
|
79512
79606
|
var symbol = getSymbolOfNode(node.parent);
|
|
79513
|
-
|
|
79514
|
-
|
|
79515
|
-
|
|
79516
|
-
|
|
79517
|
-
|
|
79518
|
-
|
|
79607
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79608
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79609
|
+
}
|
|
79610
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79611
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79612
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79613
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79614
|
+
varianceTypeParameter = typeParameter;
|
|
79615
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79616
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79617
|
+
}
|
|
79519
79618
|
}
|
|
79520
79619
|
}
|
|
79521
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79522
79620
|
}
|
|
79523
79621
|
function checkParameter(node) {
|
|
79524
79622
|
// Grammar checking
|
|
@@ -80008,7 +80106,7 @@ var ts;
|
|
|
80008
80106
|
superCallStatement = statement;
|
|
80009
80107
|
break;
|
|
80010
80108
|
}
|
|
80011
|
-
if (
|
|
80109
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80012
80110
|
break;
|
|
80013
80111
|
}
|
|
80014
80112
|
}
|
|
@@ -85361,6 +85459,9 @@ var ts;
|
|
|
85361
85459
|
case 226 /* ClassExpression */:
|
|
85362
85460
|
checkClassExpressionDeferred(node);
|
|
85363
85461
|
break;
|
|
85462
|
+
case 163 /* TypeParameter */:
|
|
85463
|
+
checkTypeParameterDeferred(node);
|
|
85464
|
+
break;
|
|
85364
85465
|
case 279 /* JsxSelfClosingElement */:
|
|
85365
85466
|
checkJsxSelfClosingElementDeferred(node);
|
|
85366
85467
|
break;
|
|
@@ -86175,11 +86276,11 @@ var ts;
|
|
|
86175
86276
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86176
86277
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86177
86278
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86178
|
-
: ts.singleElementArray(
|
|
86279
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86179
86280
|
}
|
|
86180
86281
|
return undefined;
|
|
86181
86282
|
}
|
|
86182
|
-
function
|
|
86283
|
+
function tryGetTarget(symbol) {
|
|
86183
86284
|
var target;
|
|
86184
86285
|
var next = symbol;
|
|
86185
86286
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86409,7 +86510,7 @@ var ts;
|
|
|
86409
86510
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86410
86511
|
return true;
|
|
86411
86512
|
}
|
|
86412
|
-
var target = getSymbolLinks(symbol).
|
|
86513
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86413
86514
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86414
86515
|
target.flags & 111551 /* Value */ &&
|
|
86415
86516
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86457,11 +86558,6 @@ var ts;
|
|
|
86457
86558
|
!parameter.initializer &&
|
|
86458
86559
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86459
86560
|
}
|
|
86460
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86461
|
-
return !!strictNullChecks &&
|
|
86462
|
-
isOptionalParameter(parameter) &&
|
|
86463
|
-
!parameter.initializer;
|
|
86464
|
-
}
|
|
86465
86561
|
function isExpandoFunctionDeclaration(node) {
|
|
86466
86562
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86467
86563
|
if (!declaration) {
|
|
@@ -87378,8 +87474,7 @@ var ts;
|
|
|
87378
87474
|
case 144 /* OutKeyword */:
|
|
87379
87475
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87380
87476
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87381
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87382
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87477
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87383
87478
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87384
87479
|
}
|
|
87385
87480
|
if (flags & inOutFlag) {
|
|
@@ -92613,11 +92708,11 @@ var ts;
|
|
|
92613
92708
|
}
|
|
92614
92709
|
var statements = [];
|
|
92615
92710
|
resumeLexicalEnvironment();
|
|
92616
|
-
var
|
|
92617
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92711
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92712
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92618
92713
|
// If there was a super call, visit existing statements up to and including it
|
|
92619
92714
|
if (superStatementIndex >= 0) {
|
|
92620
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92715
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92621
92716
|
}
|
|
92622
92717
|
// Transform parameters into property assignments. Transforms this:
|
|
92623
92718
|
//
|
|
@@ -92636,12 +92731,12 @@ var ts;
|
|
|
92636
92731
|
if (superStatementIndex >= 0) {
|
|
92637
92732
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92638
92733
|
}
|
|
92639
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92734
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92640
92735
|
else {
|
|
92641
|
-
statements =
|
|
92736
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92642
92737
|
}
|
|
92643
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92644
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92738
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92739
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92645
92740
|
// End the lexical environment.
|
|
92646
92741
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92647
92742
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -108405,6 +108500,10 @@ var ts;
|
|
|
108405
108500
|
return factory.updateModifiers(statement, modifiers);
|
|
108406
108501
|
}
|
|
108407
108502
|
function transformTopLevelDeclaration(input) {
|
|
108503
|
+
if (lateMarkedStatements) {
|
|
108504
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108505
|
+
;
|
|
108506
|
+
}
|
|
108408
108507
|
if (shouldStripInternal(input))
|
|
108409
108508
|
return;
|
|
108410
108509
|
switch (input.kind) {
|
|
@@ -109536,7 +109635,7 @@ var ts;
|
|
|
109536
109635
|
addOutput(buildInfoPath);
|
|
109537
109636
|
}
|
|
109538
109637
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109539
|
-
if (ts.
|
|
109638
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109540
109639
|
return;
|
|
109541
109640
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109542
109641
|
addOutput(js);
|
|
@@ -109581,7 +109680,7 @@ var ts;
|
|
|
109581
109680
|
/*@internal*/
|
|
109582
109681
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109583
109682
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109584
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109683
|
+
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));
|
|
109585
109684
|
}
|
|
109586
109685
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109587
109686
|
/*@internal*/
|
|
@@ -109623,7 +109722,7 @@ var ts;
|
|
|
109623
109722
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109624
109723
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109625
109724
|
var inputFileName = _b[_a];
|
|
109626
|
-
if (ts.
|
|
109725
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109627
109726
|
continue;
|
|
109628
109727
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109629
109728
|
if (jsFilePath)
|
|
@@ -114973,7 +115072,7 @@ var ts;
|
|
|
114973
115072
|
if (ts.outFile(options) || options.outDir)
|
|
114974
115073
|
return false;
|
|
114975
115074
|
// File if emitted next to input needs to be ignored
|
|
114976
|
-
if (ts.
|
|
115075
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
114977
115076
|
// If its declaration directory: its not ignored if not excluded by config
|
|
114978
115077
|
if (options.declarationDir)
|
|
114979
115078
|
return false;
|
|
@@ -116146,7 +116245,7 @@ var ts;
|
|
|
116146
116245
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116147
116246
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116148
116247
|
var fileName = _c[_b];
|
|
116149
|
-
if (!ts.
|
|
116248
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116150
116249
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116151
116250
|
}
|
|
116152
116251
|
}
|
|
@@ -116337,7 +116436,7 @@ var ts;
|
|
|
116337
116436
|
}
|
|
116338
116437
|
function getRedirectReferenceForResolution(file) {
|
|
116339
116438
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116340
|
-
if (redirect || !ts.
|
|
116439
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116341
116440
|
return redirect;
|
|
116342
116441
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116343
116442
|
// 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
|
|
@@ -117728,7 +117827,7 @@ var ts;
|
|
|
117728
117827
|
}
|
|
117729
117828
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117730
117829
|
// Ignore dts or any json files
|
|
117731
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
117830
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117732
117831
|
return undefined;
|
|
117733
117832
|
}
|
|
117734
117833
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117777,7 +117876,7 @@ var ts;
|
|
|
117777
117876
|
else {
|
|
117778
117877
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117779
117878
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117780
|
-
if (!ts.
|
|
117879
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117781
117880
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117782
117881
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117783
117882
|
}
|
|
@@ -118578,7 +118677,7 @@ var ts;
|
|
|
118578
118677
|
if (options.outDir) {
|
|
118579
118678
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118580
118679
|
}
|
|
118581
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118680
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118582
118681
|
// Otherwise just check if sourceFile with the name exists
|
|
118583
118682
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118584
118683
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -118911,13 +119010,9 @@ var ts;
|
|
|
118911
119010
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
118912
119011
|
var BuilderState;
|
|
118913
119012
|
(function (BuilderState) {
|
|
118914
|
-
var manyToManyPathMapCount = 0;
|
|
118915
119013
|
function createManyToManyPathMap() {
|
|
118916
119014
|
function create(forward, reverse, deleted) {
|
|
118917
|
-
var version = 0;
|
|
118918
119015
|
var map = {
|
|
118919
|
-
id: manyToManyPathMapCount++,
|
|
118920
|
-
version: function () { return version; },
|
|
118921
119016
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
118922
119017
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
118923
119018
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -118933,30 +119028,29 @@ var ts;
|
|
|
118933
119028
|
}
|
|
118934
119029
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
118935
119030
|
forward.delete(k);
|
|
118936
|
-
version++;
|
|
118937
119031
|
return true;
|
|
118938
119032
|
},
|
|
118939
119033
|
set: function (k, vSet) {
|
|
118940
|
-
|
|
119034
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
118941
119035
|
var existingVSet = forward.get(k);
|
|
118942
119036
|
forward.set(k, vSet);
|
|
118943
119037
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
118944
119038
|
if (!vSet.has(v)) {
|
|
118945
|
-
changed = true;
|
|
118946
119039
|
deleteFromMultimap(reverse, v, k);
|
|
118947
119040
|
}
|
|
118948
119041
|
});
|
|
118949
119042
|
vSet.forEach(function (v) {
|
|
118950
119043
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
118951
|
-
changed = true;
|
|
118952
119044
|
addToMultimap(reverse, v, k);
|
|
118953
119045
|
}
|
|
118954
119046
|
});
|
|
118955
|
-
if (changed) {
|
|
118956
|
-
version++;
|
|
118957
|
-
}
|
|
118958
119047
|
return map;
|
|
118959
119048
|
},
|
|
119049
|
+
clear: function () {
|
|
119050
|
+
forward.clear();
|
|
119051
|
+
reverse.clear();
|
|
119052
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119053
|
+
}
|
|
118960
119054
|
};
|
|
118961
119055
|
return map;
|
|
118962
119056
|
}
|
|
@@ -118971,11 +119065,10 @@ var ts;
|
|
|
118971
119065
|
}
|
|
118972
119066
|
set.add(v);
|
|
118973
119067
|
}
|
|
118974
|
-
function deleteFromMultimap(map, k, v
|
|
118975
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119068
|
+
function deleteFromMultimap(map, k, v) {
|
|
118976
119069
|
var set = map.get(k);
|
|
118977
119070
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
118978
|
-
if (
|
|
119071
|
+
if (!set.size) {
|
|
118979
119072
|
map.delete(k);
|
|
118980
119073
|
}
|
|
118981
119074
|
return true;
|
|
@@ -119204,7 +119297,7 @@ var ts;
|
|
|
119204
119297
|
/*forceDtsEmit*/ true);
|
|
119205
119298
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119206
119299
|
if (firstDts_1) {
|
|
119207
|
-
ts.Debug.assert(ts.
|
|
119300
|
+
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; })); });
|
|
119208
119301
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119209
119302
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119210
119303
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119262,20 +119355,6 @@ var ts;
|
|
|
119262
119355
|
var _a;
|
|
119263
119356
|
if (exportedModulesMapCache) {
|
|
119264
119357
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119265
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119266
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119267
|
-
if (state.previousCache) {
|
|
119268
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119269
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119270
|
-
// was updated, there's no need to update again
|
|
119271
|
-
return;
|
|
119272
|
-
}
|
|
119273
|
-
state.previousCache.id = cacheId;
|
|
119274
|
-
state.previousCache.version = cacheVersion;
|
|
119275
|
-
}
|
|
119276
|
-
else {
|
|
119277
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119278
|
-
}
|
|
119279
119358
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119280
119359
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119281
119360
|
}
|
|
@@ -119609,7 +119688,8 @@ var ts;
|
|
|
119609
119688
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119610
119689
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119611
119690
|
*/
|
|
119612
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119691
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119692
|
+
var _a;
|
|
119613
119693
|
while (true) {
|
|
119614
119694
|
var affectedFiles = state.affectedFiles;
|
|
119615
119695
|
if (affectedFiles) {
|
|
@@ -119620,7 +119700,7 @@ var ts;
|
|
|
119620
119700
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119621
119701
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119622
119702
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119623
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119703
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119624
119704
|
return affectedFile;
|
|
119625
119705
|
}
|
|
119626
119706
|
affectedFilesIndex++;
|
|
@@ -119632,6 +119712,7 @@ var ts;
|
|
|
119632
119712
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119633
119713
|
state.currentAffectedFilesSignatures.clear();
|
|
119634
119714
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119715
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119635
119716
|
state.affectedFiles = undefined;
|
|
119636
119717
|
}
|
|
119637
119718
|
// Get next changed file
|
|
@@ -119661,6 +119742,11 @@ var ts;
|
|
|
119661
119742
|
state.seenAffectedFiles = new ts.Set();
|
|
119662
119743
|
}
|
|
119663
119744
|
}
|
|
119745
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119746
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119747
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119748
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119749
|
+
}
|
|
119664
119750
|
/**
|
|
119665
119751
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119666
119752
|
*/
|
|
@@ -119680,9 +119766,7 @@ var ts;
|
|
|
119680
119766
|
}
|
|
119681
119767
|
}
|
|
119682
119768
|
}
|
|
119683
|
-
state
|
|
119684
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119685
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119769
|
+
clearAffectedFilesPendingEmit(state);
|
|
119686
119770
|
}
|
|
119687
119771
|
return undefined;
|
|
119688
119772
|
}
|
|
@@ -119690,7 +119774,7 @@ var ts;
|
|
|
119690
119774
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119691
119775
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119692
119776
|
*/
|
|
119693
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119777
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119694
119778
|
var _a;
|
|
119695
119779
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119696
119780
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119715,14 +119799,14 @@ var ts;
|
|
|
119715
119799
|
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);
|
|
119716
119800
|
}
|
|
119717
119801
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119718
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119802
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119719
119803
|
}
|
|
119720
119804
|
}
|
|
119721
119805
|
/**
|
|
119722
119806
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119723
119807
|
* Also we need to make sure signature is updated for these files
|
|
119724
119808
|
*/
|
|
119725
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
119809
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119726
119810
|
removeSemanticDiagnosticsOf(state, path);
|
|
119727
119811
|
if (!state.changedFilesSet.has(path)) {
|
|
119728
119812
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119733,8 +119817,7 @@ var ts;
|
|
|
119733
119817
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119734
119818
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119735
119819
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119736
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119737
|
-
/* useFileVersionAsSignature */ true);
|
|
119820
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119738
119821
|
// If not dts emit, nothing more to do
|
|
119739
119822
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119740
119823
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -119931,13 +120014,18 @@ var ts;
|
|
|
119931
120014
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
119932
120015
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
119933
120016
|
return value.version === actualSignature ?
|
|
119934
|
-
value.affectsGlobalScope ?
|
|
119935
|
-
|
|
120017
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120018
|
+
// If file version is same as signature, dont serialize signature
|
|
120019
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120020
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
119936
120021
|
value.version :
|
|
119937
|
-
actualSignature !== undefined ?
|
|
120022
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
119938
120023
|
signature === undefined ?
|
|
120024
|
+
// If we havent computed signature, use fileInfo as is
|
|
119939
120025
|
value :
|
|
120026
|
+
// Serialize fileInfo with new updated signature
|
|
119940
120027
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120028
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
119941
120029
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
119942
120030
|
});
|
|
119943
120031
|
var referencedMap;
|
|
@@ -120182,7 +120270,7 @@ var ts;
|
|
|
120182
120270
|
* in that order would be used to write the files
|
|
120183
120271
|
*/
|
|
120184
120272
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120185
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120273
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120186
120274
|
var emitKind = 1 /* Full */;
|
|
120187
120275
|
var isPendingEmitFile = false;
|
|
120188
120276
|
if (!affected) {
|
|
@@ -120227,54 +120315,48 @@ var ts;
|
|
|
120227
120315
|
* in that order would be used to write the files
|
|
120228
120316
|
*/
|
|
120229
120317
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120230
|
-
var
|
|
120231
|
-
var savedAffectedFilesPendingEmit;
|
|
120232
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120233
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120234
|
-
// 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
|
|
120235
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120236
|
-
// 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)
|
|
120237
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120238
|
-
!targetSourceFile &&
|
|
120239
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120240
|
-
!state.compilerOptions.noEmit &&
|
|
120241
|
-
state.compilerOptions.noEmitOnError) {
|
|
120242
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120243
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120244
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120245
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120246
|
-
}
|
|
120318
|
+
var _a;
|
|
120247
120319
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120248
120320
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120249
120321
|
}
|
|
120250
120322
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120251
120323
|
if (result)
|
|
120252
120324
|
return result;
|
|
120253
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120254
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120255
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120256
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120257
|
-
}
|
|
120258
120325
|
// Emit only affected files if using builder for emit
|
|
120259
|
-
if (!targetSourceFile
|
|
120260
|
-
|
|
120261
|
-
|
|
120262
|
-
|
|
120263
|
-
|
|
120264
|
-
|
|
120265
|
-
|
|
120266
|
-
|
|
120267
|
-
|
|
120268
|
-
|
|
120269
|
-
|
|
120270
|
-
|
|
120326
|
+
if (!targetSourceFile) {
|
|
120327
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120328
|
+
// Emit and report any errors we ran into.
|
|
120329
|
+
var sourceMaps = [];
|
|
120330
|
+
var emitSkipped = false;
|
|
120331
|
+
var diagnostics = void 0;
|
|
120332
|
+
var emittedFiles = [];
|
|
120333
|
+
var affectedEmitResult = void 0;
|
|
120334
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120335
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120336
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120337
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120338
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120339
|
+
}
|
|
120340
|
+
return {
|
|
120341
|
+
emitSkipped: emitSkipped,
|
|
120342
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120343
|
+
emittedFiles: emittedFiles,
|
|
120344
|
+
sourceMaps: sourceMaps
|
|
120345
|
+
};
|
|
120346
|
+
}
|
|
120347
|
+
// In non Emit builder, clear affected files pending emit
|
|
120348
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120349
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120350
|
+
// State can clear affected files pending emit if
|
|
120351
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120352
|
+
// If every file pending emit is pending on only dts emit
|
|
120353
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120354
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120355
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120356
|
+
})) {
|
|
120357
|
+
clearAffectedFilesPendingEmit(state);
|
|
120358
|
+
}
|
|
120271
120359
|
}
|
|
120272
|
-
return {
|
|
120273
|
-
emitSkipped: emitSkipped,
|
|
120274
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120275
|
-
emittedFiles: emittedFiles,
|
|
120276
|
-
sourceMaps: sourceMaps
|
|
120277
|
-
};
|
|
120278
120360
|
}
|
|
120279
120361
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120280
120362
|
}
|
|
@@ -120284,7 +120366,7 @@ var ts;
|
|
|
120284
120366
|
*/
|
|
120285
120367
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120286
120368
|
while (true) {
|
|
120287
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120369
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120288
120370
|
if (!affected) {
|
|
120289
120371
|
// Done
|
|
120290
120372
|
return undefined;
|
|
@@ -123404,9 +123486,6 @@ var ts;
|
|
|
123404
123486
|
function newer(date1, date2) {
|
|
123405
123487
|
return date2 > date1 ? date2 : date1;
|
|
123406
123488
|
}
|
|
123407
|
-
function isDeclarationFile(fileName) {
|
|
123408
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123409
|
-
}
|
|
123410
123489
|
/*@internal*/
|
|
123411
123490
|
function isCircularBuildOrder(buildOrder) {
|
|
123412
123491
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -123969,7 +124048,7 @@ var ts;
|
|
|
123969
124048
|
outputFiles.forEach(function (_a) {
|
|
123970
124049
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
123971
124050
|
var priorChangeTime;
|
|
123972
|
-
if (!anyDtsChanged &&
|
|
124051
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
123973
124052
|
// Check for unchanged .d.ts files
|
|
123974
124053
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
123975
124054
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124310,7 +124389,7 @@ var ts;
|
|
|
124310
124389
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124311
124390
|
// had its file touched but not had its contents changed - this allows us
|
|
124312
124391
|
// to skip a downstream typecheck
|
|
124313
|
-
if (
|
|
124392
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124314
124393
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124315
124394
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124316
124395
|
}
|
|
@@ -124464,7 +124543,7 @@ var ts;
|
|
|
124464
124543
|
reportVerbose = false;
|
|
124465
124544
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124466
124545
|
}
|
|
124467
|
-
if (
|
|
124546
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124468
124547
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124469
124548
|
}
|
|
124470
124549
|
host.setModifiedTime(file, now);
|
|
@@ -131359,17 +131438,13 @@ var ts;
|
|
|
131359
131438
|
}
|
|
131360
131439
|
}
|
|
131361
131440
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131362
|
-
|
|
131363
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
131441
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
|
|
131364
131442
|
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131365
131443
|
name = name + labelDetails.detail;
|
|
131366
131444
|
labelDetails = undefined;
|
|
131367
131445
|
}
|
|
131368
131446
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131369
131447
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131370
|
-
if (importAdder.hasFixes()) {
|
|
131371
|
-
hasAction = true;
|
|
131372
|
-
}
|
|
131373
131448
|
}
|
|
131374
131449
|
if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
131375
131450
|
var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
|
|
@@ -131592,8 +131667,7 @@ var ts;
|
|
|
131592
131667
|
var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
|
|
131593
131668
|
var insertText = name;
|
|
131594
131669
|
var sourceFile = enclosingDeclaration.getSourceFile();
|
|
131595
|
-
var
|
|
131596
|
-
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
|
|
131670
|
+
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
|
|
131597
131671
|
if (!method) {
|
|
131598
131672
|
return undefined;
|
|
131599
131673
|
}
|
|
@@ -131622,16 +131696,15 @@ var ts;
|
|
|
131622
131696
|
/*modifiers*/ undefined,
|
|
131623
131697
|
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
131624
131698
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
131625
|
-
return { isSnippet: isSnippet, insertText: insertText,
|
|
131699
|
+
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
131626
131700
|
}
|
|
131627
131701
|
;
|
|
131628
|
-
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences
|
|
131702
|
+
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
131629
131703
|
var declarations = symbol.getDeclarations();
|
|
131630
131704
|
if (!(declarations && declarations.length)) {
|
|
131631
131705
|
return undefined;
|
|
131632
131706
|
}
|
|
131633
131707
|
var checker = program.getTypeChecker();
|
|
131634
|
-
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
131635
131708
|
var declaration = declarations[0];
|
|
131636
131709
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
131637
131710
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
@@ -131664,11 +131737,6 @@ var ts;
|
|
|
131664
131737
|
if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
|
|
131665
131738
|
return undefined;
|
|
131666
131739
|
}
|
|
131667
|
-
var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
131668
|
-
if (importableReference) {
|
|
131669
|
-
typeNode = importableReference.typeNode;
|
|
131670
|
-
ts.codefix.importSymbols(importAdder, importableReference.symbols);
|
|
131671
|
-
}
|
|
131672
131740
|
var body = void 0;
|
|
131673
131741
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
131674
131742
|
var emptyStmt = ts.factory.createEmptyStatement();
|
|
@@ -131678,11 +131746,19 @@ var ts;
|
|
|
131678
131746
|
else {
|
|
131679
131747
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
131680
131748
|
}
|
|
131749
|
+
var parameters = typeNode.parameters.map(function (typedParam) {
|
|
131750
|
+
return ts.factory.createParameterDeclaration(
|
|
131751
|
+
/*decorators*/ undefined,
|
|
131752
|
+
/*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken,
|
|
131753
|
+
/*type*/ undefined, typedParam.initializer);
|
|
131754
|
+
});
|
|
131681
131755
|
return ts.factory.createMethodDeclaration(
|
|
131682
131756
|
/*decorators*/ undefined,
|
|
131683
131757
|
/*modifiers*/ undefined,
|
|
131684
131758
|
/*asteriskToken*/ undefined, name,
|
|
131685
|
-
/*questionToken*/ undefined,
|
|
131759
|
+
/*questionToken*/ undefined,
|
|
131760
|
+
/*typeParameters*/ undefined, parameters,
|
|
131761
|
+
/*type*/ undefined, body);
|
|
131686
131762
|
}
|
|
131687
131763
|
default:
|
|
131688
131764
|
return undefined;
|
|
@@ -132045,20 +132121,6 @@ var ts;
|
|
|
132045
132121
|
};
|
|
132046
132122
|
}
|
|
132047
132123
|
}
|
|
132048
|
-
if (source === CompletionSource.ObjectLiteralMethodSnippet) {
|
|
132049
|
-
var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
|
|
132050
|
-
var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
|
|
132051
|
-
if (importAdder.hasFixes()) {
|
|
132052
|
-
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
132053
|
-
return {
|
|
132054
|
-
sourceDisplay: undefined,
|
|
132055
|
-
codeActions: [{
|
|
132056
|
-
changes: changes,
|
|
132057
|
-
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
132058
|
-
}],
|
|
132059
|
-
};
|
|
132060
|
-
}
|
|
132061
|
-
}
|
|
132062
132124
|
if (originIsTypeOnlyAlias(origin)) {
|
|
132063
132125
|
var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
|
|
132064
132126
|
ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
|
|
@@ -134879,7 +134941,7 @@ var ts;
|
|
|
134879
134941
|
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
134880
134942
|
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
134881
134943
|
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
134882
|
-
var otherBucketKey = !ts.
|
|
134944
|
+
var otherBucketKey = !ts.isDeclarationFileName(path) &&
|
|
134883
134945
|
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
|
|
134884
134946
|
if (otherBucketKey) {
|
|
134885
134947
|
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
|
|
@@ -136819,6 +136881,30 @@ var ts;
|
|
|
136819
136881
|
}
|
|
136820
136882
|
}
|
|
136821
136883
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
136884
|
+
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
136885
|
+
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
136886
|
+
return candidates.reduce(function (topMost, decl) {
|
|
136887
|
+
var depth = getDepth(decl);
|
|
136888
|
+
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
136889
|
+
topMost.declarationNames.push(decl);
|
|
136890
|
+
topMost.depth = depth;
|
|
136891
|
+
}
|
|
136892
|
+
else if (depth < topMost.depth) {
|
|
136893
|
+
topMost.declarationNames = [decl];
|
|
136894
|
+
topMost.depth = depth;
|
|
136895
|
+
}
|
|
136896
|
+
return topMost;
|
|
136897
|
+
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
136898
|
+
function getDepth(declaration) {
|
|
136899
|
+
var depth = 0;
|
|
136900
|
+
while (declaration) {
|
|
136901
|
+
declaration = ts.getContainerNode(declaration);
|
|
136902
|
+
depth++;
|
|
136903
|
+
}
|
|
136904
|
+
return depth;
|
|
136905
|
+
}
|
|
136906
|
+
}
|
|
136907
|
+
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
136822
136908
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
136823
136909
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
136824
136910
|
return false;
|
|
@@ -138455,7 +138541,9 @@ var ts;
|
|
|
138455
138541
|
(function (ts) {
|
|
138456
138542
|
var GoToDefinition;
|
|
138457
138543
|
(function (GoToDefinition) {
|
|
138458
|
-
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
138544
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
138545
|
+
var _a;
|
|
138546
|
+
var _b;
|
|
138459
138547
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
138460
138548
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
138461
138549
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -138478,33 +138566,63 @@ var ts;
|
|
|
138478
138566
|
}
|
|
138479
138567
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138480
138568
|
var classDecl = node.parent.parent;
|
|
138481
|
-
var
|
|
138569
|
+
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138482
138570
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138483
138571
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138484
138572
|
var sourceFile_1 = node.getSourceFile();
|
|
138485
138573
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
138486
138574
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
138487
138575
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
138488
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
138576
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
138489
138577
|
});
|
|
138490
138578
|
}
|
|
138491
|
-
var
|
|
138579
|
+
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138580
|
+
var fallbackNode = node;
|
|
138581
|
+
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
138582
|
+
// We couldn't resolve the specific import, try on the module specifier.
|
|
138583
|
+
var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
|
|
138584
|
+
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138585
|
+
if (moduleSpecifier) {
|
|
138586
|
+
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138587
|
+
fallbackNode = moduleSpecifier;
|
|
138588
|
+
}
|
|
138589
|
+
}
|
|
138590
|
+
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
138591
|
+
// We couldn't resolve the module specifier as an external module, but it could
|
|
138592
|
+
// be that module resolution succeeded but the target was not a module.
|
|
138593
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
138594
|
+
if (ref) {
|
|
138595
|
+
return [{
|
|
138596
|
+
name: fallbackNode.text,
|
|
138597
|
+
fileName: ref.resolvedFileName,
|
|
138598
|
+
containerName: undefined,
|
|
138599
|
+
containerKind: undefined,
|
|
138600
|
+
kind: "script" /* scriptElement */,
|
|
138601
|
+
textSpan: ts.createTextSpan(0, 0),
|
|
138602
|
+
failedAliasResolution: failedAliasResolution,
|
|
138603
|
+
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
138604
|
+
unverified: fallbackNode !== node,
|
|
138605
|
+
}];
|
|
138606
|
+
}
|
|
138607
|
+
}
|
|
138492
138608
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
138493
138609
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
138494
138610
|
if (!symbol) {
|
|
138495
138611
|
return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
|
138496
138612
|
}
|
|
138613
|
+
if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
|
|
138614
|
+
return undefined;
|
|
138497
138615
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
138498
138616
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
138499
138617
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
138500
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
138618
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
138501
138619
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
138502
138620
|
// If this is the original constructor definition, parent is the class.
|
|
138503
138621
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
138504
138622
|
return [sigInfo];
|
|
138505
138623
|
}
|
|
138506
138624
|
else {
|
|
138507
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
138625
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
|
|
138508
138626
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
138509
138627
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
138510
138628
|
}
|
|
@@ -138516,7 +138634,7 @@ var ts;
|
|
|
138516
138634
|
// assignment. This case and others are handled by the following code.
|
|
138517
138635
|
if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
|
|
138518
138636
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
138519
|
-
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : ts.emptyArray;
|
|
138637
|
+
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray;
|
|
138520
138638
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
138521
138639
|
}
|
|
138522
138640
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -138539,7 +138657,7 @@ var ts;
|
|
|
138539
138657
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
138540
138658
|
});
|
|
138541
138659
|
}
|
|
138542
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
138660
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
|
|
138543
138661
|
}
|
|
138544
138662
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
138545
138663
|
/**
|
|
@@ -138637,24 +138755,24 @@ var ts;
|
|
|
138637
138755
|
return undefined;
|
|
138638
138756
|
}
|
|
138639
138757
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138640
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
138758
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
138641
138759
|
}
|
|
138642
|
-
var
|
|
138760
|
+
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138643
138761
|
if (!symbol)
|
|
138644
138762
|
return undefined;
|
|
138645
138763
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
138646
138764
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
138647
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
138765
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
138648
138766
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
138649
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
138767
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
138650
138768
|
return typeDefinitions.length ? typeDefinitions
|
|
138651
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
138769
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node, failedAliasResolution)
|
|
138652
138770
|
: undefined;
|
|
138653
138771
|
}
|
|
138654
138772
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
138655
|
-
function definitionFromType(type, checker, node) {
|
|
138773
|
+
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
138656
138774
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
138657
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
138775
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
|
|
138658
138776
|
});
|
|
138659
138777
|
}
|
|
138660
138778
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -138696,13 +138814,17 @@ var ts;
|
|
|
138696
138814
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
138697
138815
|
// import {A, B} from "mod";
|
|
138698
138816
|
// to jump to the implementation directly.
|
|
138817
|
+
var failedAliasResolution = false;
|
|
138699
138818
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
138700
138819
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
138701
138820
|
if (aliased.declarations) {
|
|
138702
|
-
return aliased;
|
|
138821
|
+
return { symbol: aliased };
|
|
138822
|
+
}
|
|
138823
|
+
else {
|
|
138824
|
+
failedAliasResolution = true;
|
|
138703
138825
|
}
|
|
138704
138826
|
}
|
|
138705
|
-
return symbol;
|
|
138827
|
+
return { symbol: symbol, failedAliasResolution: failedAliasResolution };
|
|
138706
138828
|
}
|
|
138707
138829
|
// Go to the original declaration for cases:
|
|
138708
138830
|
//
|
|
@@ -138716,26 +138838,45 @@ var ts;
|
|
|
138716
138838
|
if (node.parent === declaration) {
|
|
138717
138839
|
return true;
|
|
138718
138840
|
}
|
|
138719
|
-
|
|
138720
|
-
|
|
138721
|
-
case 265 /* ImportEqualsDeclaration */:
|
|
138722
|
-
return true;
|
|
138723
|
-
case 270 /* ImportSpecifier */:
|
|
138724
|
-
return declaration.parent.kind === 269 /* NamedImports */;
|
|
138725
|
-
case 203 /* BindingElement */:
|
|
138726
|
-
case 254 /* VariableDeclaration */:
|
|
138727
|
-
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
138728
|
-
default:
|
|
138729
|
-
return false;
|
|
138841
|
+
if (declaration.kind === 268 /* NamespaceImport */) {
|
|
138842
|
+
return false;
|
|
138730
138843
|
}
|
|
138844
|
+
return true;
|
|
138731
138845
|
}
|
|
138732
|
-
|
|
138733
|
-
|
|
138734
|
-
|
|
138735
|
-
|
|
138736
|
-
|
|
138737
|
-
|
|
138738
|
-
|
|
138846
|
+
/**
|
|
138847
|
+
* ```ts
|
|
138848
|
+
* function f() {}
|
|
138849
|
+
* f.foo = 0;
|
|
138850
|
+
* ```
|
|
138851
|
+
*
|
|
138852
|
+
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
138853
|
+
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
138854
|
+
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
138855
|
+
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
138856
|
+
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
138857
|
+
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
138858
|
+
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
138859
|
+
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
138860
|
+
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
138861
|
+
* up with a more precise definition of what counts as a definition.
|
|
138862
|
+
*/
|
|
138863
|
+
function isExpandoDeclaration(node) {
|
|
138864
|
+
if (!ts.isAssignmentDeclaration(node))
|
|
138865
|
+
return false;
|
|
138866
|
+
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
138867
|
+
if (ts.isAssignmentExpression(p))
|
|
138868
|
+
return true;
|
|
138869
|
+
if (!ts.isAssignmentDeclaration(p))
|
|
138870
|
+
return "quit";
|
|
138871
|
+
return false;
|
|
138872
|
+
});
|
|
138873
|
+
return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
|
|
138874
|
+
}
|
|
138875
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
|
|
138876
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; });
|
|
138877
|
+
var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); });
|
|
138878
|
+
var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
|
|
138879
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); });
|
|
138739
138880
|
function getConstructSignatureDefinition() {
|
|
138740
138881
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
138741
138882
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -138759,26 +138900,27 @@ var ts;
|
|
|
138759
138900
|
return declarations.length
|
|
138760
138901
|
? declarationsWithBody.length !== 0
|
|
138761
138902
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
138762
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
138903
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
|
|
138763
138904
|
: undefined;
|
|
138764
138905
|
}
|
|
138765
138906
|
}
|
|
138766
138907
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
138767
|
-
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
138908
|
+
function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
|
|
138768
138909
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
138769
138910
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
138770
138911
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
138771
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
138912
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
|
|
138772
138913
|
}
|
|
138914
|
+
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
138773
138915
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
138774
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
138916
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
|
|
138775
138917
|
var sourceFile = declaration.getSourceFile();
|
|
138776
138918
|
if (!textSpan) {
|
|
138777
138919
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
138778
138920
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
138779
138921
|
}
|
|
138780
138922
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
138781
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
138923
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216 /* Ambient */), unverified: unverified, failedAliasResolution: failedAliasResolution });
|
|
138782
138924
|
}
|
|
138783
138925
|
function isDefinitionVisible(checker, declaration) {
|
|
138784
138926
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -138811,8 +138953,8 @@ var ts;
|
|
|
138811
138953
|
return false;
|
|
138812
138954
|
}
|
|
138813
138955
|
}
|
|
138814
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
138815
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
138956
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
|
|
138957
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
|
|
138816
138958
|
}
|
|
138817
138959
|
function findReferenceInPosition(refs, pos) {
|
|
138818
138960
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -151927,9 +152069,10 @@ var ts;
|
|
|
151927
152069
|
// 2. add "member3" to the second import statement's import list
|
|
151928
152070
|
// and it is up to the user to decide which one fits best.
|
|
151929
152071
|
return ts.firstDefined(existingImports, function (_a) {
|
|
152072
|
+
var _b;
|
|
151930
152073
|
var declaration = _a.declaration;
|
|
151931
152074
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
151932
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152075
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
151933
152076
|
if (namespacePrefix && moduleSpecifier) {
|
|
151934
152077
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
151935
152078
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -152105,8 +152248,9 @@ var ts;
|
|
|
152105
152248
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
152106
152249
|
}
|
|
152107
152250
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152251
|
+
var _b;
|
|
152108
152252
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
152109
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152253
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152110
152254
|
if (moduleSpecifier) {
|
|
152111
152255
|
var addAsTypeOnly = useRequire
|
|
152112
152256
|
? 4 /* NotAllowed */
|
|
@@ -156464,7 +156608,6 @@ var ts;
|
|
|
156464
156608
|
var checker = program.getTypeChecker();
|
|
156465
156609
|
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
156466
156610
|
var flags = 1 /* NoTruncation */
|
|
156467
|
-
| 1073741824 /* NoUndefinedOptionalParameterType */
|
|
156468
156611
|
| 256 /* SuppressAnyReturnType */
|
|
156469
156612
|
| 524288 /* AllowEmptyTuple */
|
|
156470
156613
|
| (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
@@ -158843,6 +158986,7 @@ var ts;
|
|
|
158843
158986
|
Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes");
|
|
158844
158987
|
Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS");
|
|
158845
158988
|
Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block");
|
|
158989
|
+
Messages.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method");
|
|
158846
158990
|
})(Messages = extractSymbol.Messages || (extractSymbol.Messages = {}));
|
|
158847
158991
|
var RangeFacts;
|
|
158848
158992
|
(function (RangeFacts) {
|
|
@@ -158851,10 +158995,11 @@ var ts;
|
|
|
158851
158995
|
RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator";
|
|
158852
158996
|
RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction";
|
|
158853
158997
|
RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis";
|
|
158998
|
+
RangeFacts[RangeFacts["UsesThisInFunction"] = 16] = "UsesThisInFunction";
|
|
158854
158999
|
/**
|
|
158855
159000
|
* The range is in a function which needs the 'static' modifier in a class
|
|
158856
159001
|
*/
|
|
158857
|
-
RangeFacts[RangeFacts["InStaticRegion"] =
|
|
159002
|
+
RangeFacts[RangeFacts["InStaticRegion"] = 32] = "InStaticRegion";
|
|
158858
159003
|
})(RangeFacts || (RangeFacts = {}));
|
|
158859
159004
|
/**
|
|
158860
159005
|
* getRangeToExtract takes a span inside a text file and returns either an expression or an array
|
|
@@ -158885,6 +159030,7 @@ var ts;
|
|
|
158885
159030
|
// We'll modify these flags as we walk the tree to collect data
|
|
158886
159031
|
// about what things need to be done as part of the extraction.
|
|
158887
159032
|
var rangeFacts = RangeFacts.None;
|
|
159033
|
+
var thisNode;
|
|
158888
159034
|
if (!start || !end) {
|
|
158889
159035
|
// cannot find either start or end node
|
|
158890
159036
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
@@ -158923,7 +159069,7 @@ var ts;
|
|
|
158923
159069
|
// the expression.
|
|
158924
159070
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
158925
159071
|
}
|
|
158926
|
-
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } };
|
|
159072
|
+
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
|
|
158927
159073
|
}
|
|
158928
159074
|
if (ts.isReturnStatement(start) && !start.expression) {
|
|
158929
159075
|
// Makes no sense to extract an expression-less return statement.
|
|
@@ -158935,7 +159081,7 @@ var ts;
|
|
|
158935
159081
|
if (errors) {
|
|
158936
159082
|
return { errors: errors };
|
|
158937
159083
|
}
|
|
158938
|
-
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } }; // TODO: GH#18217
|
|
159084
|
+
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
|
|
158939
159085
|
/**
|
|
158940
159086
|
* Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
|
|
158941
159087
|
* @param node The unrefined extraction node.
|
|
@@ -159027,6 +159173,14 @@ var ts;
|
|
|
159027
159173
|
var permittedJumps = 4 /* Return */;
|
|
159028
159174
|
var seenLabels;
|
|
159029
159175
|
visit(nodeToCheck);
|
|
159176
|
+
if (rangeFacts & RangeFacts.UsesThis) {
|
|
159177
|
+
var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false);
|
|
159178
|
+
if (container.kind === 256 /* FunctionDeclaration */ ||
|
|
159179
|
+
(container.kind === 169 /* MethodDeclaration */ && container.parent.kind === 205 /* ObjectLiteralExpression */) ||
|
|
159180
|
+
container.kind === 213 /* FunctionExpression */) {
|
|
159181
|
+
rangeFacts |= RangeFacts.UsesThisInFunction;
|
|
159182
|
+
}
|
|
159183
|
+
}
|
|
159030
159184
|
return errors;
|
|
159031
159185
|
function visit(node) {
|
|
159032
159186
|
if (errors) {
|
|
@@ -159065,6 +159219,7 @@ var ts;
|
|
|
159065
159219
|
}
|
|
159066
159220
|
else {
|
|
159067
159221
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159222
|
+
thisNode = node;
|
|
159068
159223
|
}
|
|
159069
159224
|
break;
|
|
159070
159225
|
case 214 /* ArrowFunction */:
|
|
@@ -159072,6 +159227,7 @@ var ts;
|
|
|
159072
159227
|
ts.forEachChild(node, function check(n) {
|
|
159073
159228
|
if (ts.isThis(n)) {
|
|
159074
159229
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159230
|
+
thisNode = node;
|
|
159075
159231
|
}
|
|
159076
159232
|
else if (ts.isClassLike(n) || (ts.isFunctionLike(n) && !ts.isArrowFunction(n))) {
|
|
159077
159233
|
return false;
|
|
@@ -159128,6 +159284,7 @@ var ts;
|
|
|
159128
159284
|
case 192 /* ThisType */:
|
|
159129
159285
|
case 108 /* ThisKeyword */:
|
|
159130
159286
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159287
|
+
thisNode = node;
|
|
159131
159288
|
break;
|
|
159132
159289
|
case 250 /* LabeledStatement */: {
|
|
159133
159290
|
var label = node.label;
|
|
@@ -159215,7 +159372,7 @@ var ts;
|
|
|
159215
159372
|
*/
|
|
159216
159373
|
function collectEnclosingScopes(range) {
|
|
159217
159374
|
var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range;
|
|
159218
|
-
if (range.facts & RangeFacts.UsesThis) {
|
|
159375
|
+
if (range.facts & RangeFacts.UsesThis && !(range.facts & RangeFacts.UsesThisInFunction)) {
|
|
159219
159376
|
// if range uses this as keyword or as type inside the class then it can only be extracted to a method of the containing class
|
|
159220
159377
|
var containingClass = ts.getContainingClass(current);
|
|
159221
159378
|
if (containingClass) {
|
|
@@ -159421,6 +159578,7 @@ var ts;
|
|
|
159421
159578
|
var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty;
|
|
159422
159579
|
ts.suppressLeadingAndTrailingTrivia(body);
|
|
159423
159580
|
var newFunction;
|
|
159581
|
+
var callThis = !!(range.facts & RangeFacts.UsesThisInFunction);
|
|
159424
159582
|
if (ts.isClassLike(scope)) {
|
|
159425
159583
|
// always create private method in TypeScript files
|
|
159426
159584
|
var modifiers = isJS ? [] : [ts.factory.createModifier(121 /* PrivateKeyword */)];
|
|
@@ -159435,6 +159593,15 @@ var ts;
|
|
|
159435
159593
|
/*questionToken*/ undefined, typeParameters, parameters, returnType, body);
|
|
159436
159594
|
}
|
|
159437
159595
|
else {
|
|
159596
|
+
if (callThis) {
|
|
159597
|
+
parameters.unshift(ts.factory.createParameterDeclaration(
|
|
159598
|
+
/*decorators*/ undefined,
|
|
159599
|
+
/*modifiers*/ undefined,
|
|
159600
|
+
/*dotDotDotToken*/ undefined,
|
|
159601
|
+
/*name*/ "this",
|
|
159602
|
+
/*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NoTruncation */),
|
|
159603
|
+
/*initializer*/ undefined));
|
|
159604
|
+
}
|
|
159438
159605
|
newFunction = ts.factory.createFunctionDeclaration(
|
|
159439
159606
|
/*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
|
|
159440
159607
|
}
|
|
@@ -159451,7 +159618,10 @@ var ts;
|
|
|
159451
159618
|
var newNodes = [];
|
|
159452
159619
|
// replace range with function call
|
|
159453
159620
|
var called = getCalledExpression(scope, range, functionNameText);
|
|
159454
|
-
|
|
159621
|
+
if (callThis) {
|
|
159622
|
+
callArguments.unshift(ts.factory.createIdentifier("this"));
|
|
159623
|
+
}
|
|
159624
|
+
var call = ts.factory.createCallExpression(callThis ? ts.factory.createPropertyAccessExpression(called, "call") : called, callTypeArguments, // Note that no attempt is made to take advantage of type argument inference
|
|
159455
159625
|
callArguments);
|
|
159456
159626
|
if (range.facts & RangeFacts.IsGenerator) {
|
|
159457
159627
|
call = ts.factory.createYieldExpression(ts.factory.createToken(41 /* AsteriskToken */), call);
|
|
@@ -160062,6 +160232,9 @@ var ts;
|
|
|
160062
160232
|
var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
|
|
160063
160233
|
constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
|
|
160064
160234
|
}
|
|
160235
|
+
if (targetRange.facts & RangeFacts.UsesThisInFunction && ts.isClassLike(scopes[i])) {
|
|
160236
|
+
functionErrorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
|
|
160237
|
+
}
|
|
160065
160238
|
var hasWrite = false;
|
|
160066
160239
|
var readonlyClassPropertyWrite;
|
|
160067
160240
|
usagesPerScope[i].usages.forEach(function (value) {
|
|
@@ -164015,9 +164188,9 @@ var ts;
|
|
|
164015
164188
|
}
|
|
164016
164189
|
}
|
|
164017
164190
|
/// Goto definition
|
|
164018
|
-
function getDefinitionAtPosition(fileName, position) {
|
|
164191
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164019
164192
|
synchronizeHostData();
|
|
164020
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
164193
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164021
164194
|
}
|
|
164022
164195
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164023
164196
|
synchronizeHostData();
|
|
@@ -166975,6 +167148,11 @@ var ts;
|
|
|
166975
167148
|
return "/dev/null/autoImportProviderProject" + counter + "*";
|
|
166976
167149
|
}
|
|
166977
167150
|
server.makeAutoImportProviderProjectName = makeAutoImportProviderProjectName;
|
|
167151
|
+
/*@internal*/
|
|
167152
|
+
function makeAuxiliaryProjectName(counter) {
|
|
167153
|
+
return "/dev/null/auxiliaryProject" + counter + "*";
|
|
167154
|
+
}
|
|
167155
|
+
server.makeAuxiliaryProjectName = makeAuxiliaryProjectName;
|
|
166978
167156
|
function createSortedArray() {
|
|
166979
167157
|
return []; // TODO: GH#19873
|
|
166980
167158
|
}
|
|
@@ -167188,6 +167366,7 @@ var ts;
|
|
|
167188
167366
|
CommandTypes["SignatureHelp"] = "signatureHelp";
|
|
167189
167367
|
/* @internal */
|
|
167190
167368
|
CommandTypes["SignatureHelpFull"] = "signatureHelp-full";
|
|
167369
|
+
CommandTypes["FindSourceDefinition"] = "findSourceDefinition";
|
|
167191
167370
|
CommandTypes["Status"] = "status";
|
|
167192
167371
|
CommandTypes["TypeDefinition"] = "typeDefinition";
|
|
167193
167372
|
CommandTypes["ProjectInfo"] = "projectInfo";
|
|
@@ -167767,7 +167946,7 @@ var ts;
|
|
|
167767
167946
|
case 0:
|
|
167768
167947
|
return server.Errors.ThrowNoProject();
|
|
167769
167948
|
case 1:
|
|
167770
|
-
return
|
|
167949
|
+
return ensurePrimaryProjectKind(this.containingProjects[0]);
|
|
167771
167950
|
default:
|
|
167772
167951
|
// If this file belongs to multiple projects, below is the order in which default project is used
|
|
167773
167952
|
// - for open script info, its default configured project during opening is default if info is part of it
|
|
@@ -167805,7 +167984,7 @@ var ts;
|
|
|
167805
167984
|
firstInferredProject = project;
|
|
167806
167985
|
}
|
|
167807
167986
|
}
|
|
167808
|
-
return
|
|
167987
|
+
return ensurePrimaryProjectKind(defaultConfiguredProject ||
|
|
167809
167988
|
firstNonSourceOfProjectReferenceRedirect ||
|
|
167810
167989
|
firstConfiguredProject ||
|
|
167811
167990
|
firstExternalProject ||
|
|
@@ -167881,8 +168060,8 @@ var ts;
|
|
|
167881
168060
|
return !ts.forEach(this.containingProjects, function (p) { return !p.isOrphan(); });
|
|
167882
168061
|
};
|
|
167883
168062
|
/*@internal*/
|
|
167884
|
-
ScriptInfo.prototype.
|
|
167885
|
-
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider; });
|
|
168063
|
+
ScriptInfo.prototype.isContainedByBackgroundProject = function () {
|
|
168064
|
+
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider || p.projectKind === server.ProjectKind.Auxiliary; });
|
|
167886
168065
|
};
|
|
167887
168066
|
/**
|
|
167888
168067
|
* @param line 1 based index
|
|
@@ -167916,8 +168095,13 @@ var ts;
|
|
|
167916
168095
|
return ScriptInfo;
|
|
167917
168096
|
}());
|
|
167918
168097
|
server.ScriptInfo = ScriptInfo;
|
|
167919
|
-
|
|
167920
|
-
|
|
168098
|
+
/**
|
|
168099
|
+
* Throws an error if `project` is an AutoImportProvider or AuxiliaryProject,
|
|
168100
|
+
* which are used in the background by other Projects and should never be
|
|
168101
|
+
* reported as the default project for a ScriptInfo.
|
|
168102
|
+
*/
|
|
168103
|
+
function ensurePrimaryProjectKind(project) {
|
|
168104
|
+
if (!project || project.projectKind === server.ProjectKind.AutoImportProvider || project.projectKind === server.ProjectKind.Auxiliary) {
|
|
167921
168105
|
return server.Errors.ThrowNoProject();
|
|
167922
168106
|
}
|
|
167923
168107
|
return project;
|
|
@@ -168057,6 +168241,7 @@ var ts;
|
|
|
168057
168241
|
ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
|
|
168058
168242
|
ProjectKind[ProjectKind["External"] = 2] = "External";
|
|
168059
168243
|
ProjectKind[ProjectKind["AutoImportProvider"] = 3] = "AutoImportProvider";
|
|
168244
|
+
ProjectKind[ProjectKind["Auxiliary"] = 4] = "Auxiliary";
|
|
168060
168245
|
})(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));
|
|
168061
168246
|
/* @internal */
|
|
168062
168247
|
function countEachFileTypes(infos, includeSizes) {
|
|
@@ -168082,7 +168267,7 @@ var ts;
|
|
|
168082
168267
|
result.jsxSize += fileSize;
|
|
168083
168268
|
break;
|
|
168084
168269
|
case 3 /* TS */:
|
|
168085
|
-
if (ts.
|
|
168270
|
+
if (ts.isDeclarationFileName(info.fileName)) {
|
|
168086
168271
|
result.dts += 1;
|
|
168087
168272
|
result.dtsSize += fileSize;
|
|
168088
168273
|
}
|
|
@@ -168120,7 +168305,7 @@ var ts;
|
|
|
168120
168305
|
server.allFilesAreJsOrDts = allFilesAreJsOrDts;
|
|
168121
168306
|
/* @internal */
|
|
168122
168307
|
function hasNoTypeScriptSource(fileNames) {
|
|
168123
|
-
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.
|
|
168308
|
+
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.isDeclarationFileName(fileName)) || ts.fileExtensionIs(fileName, ".tsx" /* Tsx */); });
|
|
168124
168309
|
}
|
|
168125
168310
|
server.hasNoTypeScriptSource = hasNoTypeScriptSource;
|
|
168126
168311
|
function isGeneratedFileWatcher(watch) {
|
|
@@ -168524,7 +168709,7 @@ var ts;
|
|
|
168524
168709
|
}
|
|
168525
168710
|
// Update the signature
|
|
168526
168711
|
if (this.builderState && ts.getEmitDeclarations(this.compilerOptions)) {
|
|
168527
|
-
var dtsFiles = outputFiles.filter(function (f) { return ts.
|
|
168712
|
+
var dtsFiles = outputFiles.filter(function (f) { return ts.isDeclarationFileName(f.name); });
|
|
168528
168713
|
if (dtsFiles.length === 1) {
|
|
168529
168714
|
var sourceFile = this.program.getSourceFile(scriptInfo.fileName);
|
|
168530
168715
|
var signature = this.projectService.host.createHash ?
|
|
@@ -168643,6 +168828,10 @@ var ts;
|
|
|
168643
168828
|
this.autoImportProviderHost.close();
|
|
168644
168829
|
}
|
|
168645
168830
|
this.autoImportProviderHost = undefined;
|
|
168831
|
+
if (this.noDtsResolutionProject) {
|
|
168832
|
+
this.noDtsResolutionProject.close();
|
|
168833
|
+
}
|
|
168834
|
+
this.noDtsResolutionProject = undefined;
|
|
168646
168835
|
// signal language service to release source files acquired from document registry
|
|
168647
168836
|
this.languageService.dispose();
|
|
168648
168837
|
this.languageService = undefined;
|
|
@@ -169165,11 +169354,13 @@ var ts;
|
|
|
169165
169354
|
}
|
|
169166
169355
|
};
|
|
169167
169356
|
Project.prototype.setCompilerOptions = function (compilerOptions) {
|
|
169357
|
+
var _a;
|
|
169168
169358
|
if (compilerOptions) {
|
|
169169
169359
|
compilerOptions.allowNonTsExtensions = true;
|
|
169170
169360
|
var oldOptions = this.compilerOptions;
|
|
169171
169361
|
this.compilerOptions = compilerOptions;
|
|
169172
169362
|
this.setInternalCompilerOptionsForEmittingJsFiles();
|
|
169363
|
+
(_a = this.noDtsResolutionProject) === null || _a === void 0 ? void 0 : _a.setCompilerOptions(this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169173
169364
|
if (ts.changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
169174
169365
|
// reset cached unresolved imports if changes in compiler options affected module resolution
|
|
169175
169366
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
@@ -169509,6 +169700,31 @@ var ts;
|
|
|
169509
169700
|
Project.prototype.getIncompleteCompletionsCache = function () {
|
|
169510
169701
|
return this.projectService.getIncompleteCompletionsCache();
|
|
169511
169702
|
};
|
|
169703
|
+
/*@internal*/
|
|
169704
|
+
Project.prototype.getNoDtsResolutionProject = function (rootFileNames) {
|
|
169705
|
+
var _this = this;
|
|
169706
|
+
ts.Debug.assert(this.projectService.serverMode === ts.LanguageServiceMode.Semantic);
|
|
169707
|
+
if (!this.noDtsResolutionProject) {
|
|
169708
|
+
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169709
|
+
}
|
|
169710
|
+
ts.enumerateInsertsAndDeletes(rootFileNames.map(server.toNormalizedPath), this.noDtsResolutionProject.getRootFiles(), ts.getStringComparer(!this.useCaseSensitiveFileNames()), function (pathToAdd) {
|
|
169711
|
+
var info = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(pathToAdd, _this.currentDirectory, _this.noDtsResolutionProject.directoryStructureHost);
|
|
169712
|
+
if (info) {
|
|
169713
|
+
_this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
169714
|
+
}
|
|
169715
|
+
}, function (pathToRemove) {
|
|
169716
|
+
// It may be preferable to remove roots only once project grows to a certain size?
|
|
169717
|
+
var info = _this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
169718
|
+
if (info) {
|
|
169719
|
+
_this.noDtsResolutionProject.removeRoot(info);
|
|
169720
|
+
}
|
|
169721
|
+
});
|
|
169722
|
+
return this.noDtsResolutionProject;
|
|
169723
|
+
};
|
|
169724
|
+
/*@internal*/
|
|
169725
|
+
Project.prototype.getCompilerOptionsForNoDtsResolutionProject = function () {
|
|
169726
|
+
return __assign(__assign({}, this.getCompilerOptions()), { noDtsResolution: true, allowJs: true, maxNodeModuleJsDepth: 3, diagnostics: false, skipLibCheck: true, sourceMap: false, types: ts.emptyArray, lib: ts.emptyArray, noLib: true });
|
|
169727
|
+
};
|
|
169512
169728
|
return Project;
|
|
169513
169729
|
}());
|
|
169514
169730
|
server.Project = Project;
|
|
@@ -169624,6 +169840,26 @@ var ts;
|
|
|
169624
169840
|
return InferredProject;
|
|
169625
169841
|
}(Project));
|
|
169626
169842
|
server.InferredProject = InferredProject;
|
|
169843
|
+
var AuxiliaryProject = /** @class */ (function (_super) {
|
|
169844
|
+
__extends(AuxiliaryProject, _super);
|
|
169845
|
+
function AuxiliaryProject(projectService, documentRegistry, compilerOptions) {
|
|
169846
|
+
return _super.call(this, projectService.newAuxiliaryProjectName(), ProjectKind.Auxiliary, projectService, documentRegistry,
|
|
169847
|
+
/*hasExplicitListOfFiles*/ false,
|
|
169848
|
+
/*lastFileExceededProgramSize*/ undefined, compilerOptions,
|
|
169849
|
+
/*compileOnSaveEnabled*/ false,
|
|
169850
|
+
/*watchOptions*/ undefined, projectService.host,
|
|
169851
|
+
/*currentDirectory*/ undefined) || this;
|
|
169852
|
+
}
|
|
169853
|
+
AuxiliaryProject.prototype.isOrphan = function () {
|
|
169854
|
+
return true;
|
|
169855
|
+
};
|
|
169856
|
+
/*@internal*/
|
|
169857
|
+
AuxiliaryProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
169858
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
169859
|
+
return;
|
|
169860
|
+
};
|
|
169861
|
+
return AuxiliaryProject;
|
|
169862
|
+
}(Project));
|
|
169627
169863
|
var AutoImportProviderProject = /** @class */ (function (_super) {
|
|
169628
169864
|
__extends(AutoImportProviderProject, _super);
|
|
169629
169865
|
/*@internal*/
|
|
@@ -169775,6 +170011,11 @@ var ts;
|
|
|
169775
170011
|
}
|
|
169776
170012
|
return hasSameSetOfFiles;
|
|
169777
170013
|
};
|
|
170014
|
+
/*@internal*/
|
|
170015
|
+
AutoImportProviderProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170016
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170017
|
+
return;
|
|
170018
|
+
};
|
|
169778
170019
|
AutoImportProviderProject.prototype.hasRoots = function () {
|
|
169779
170020
|
var _a;
|
|
169780
170021
|
return !!((_a = this.rootFileNames) === null || _a === void 0 ? void 0 : _a.length);
|
|
@@ -170460,6 +170701,8 @@ var ts;
|
|
|
170460
170701
|
this.newInferredProjectName = createProjectNameFactoryWithCounter(server.makeInferredProjectName);
|
|
170461
170702
|
/*@internal*/
|
|
170462
170703
|
this.newAutoImportProviderProjectName = createProjectNameFactoryWithCounter(server.makeAutoImportProviderProjectName);
|
|
170704
|
+
/*@internal*/
|
|
170705
|
+
this.newAuxiliaryProjectName = createProjectNameFactoryWithCounter(server.makeAuxiliaryProjectName);
|
|
170463
170706
|
/**
|
|
170464
170707
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
170465
170708
|
*/
|
|
@@ -170663,13 +170906,15 @@ var ts;
|
|
|
170663
170906
|
ProjectService.prototype.delayUpdateProjectGraph = function (project) {
|
|
170664
170907
|
var _this = this;
|
|
170665
170908
|
project.markAsDirty();
|
|
170666
|
-
|
|
170667
|
-
|
|
170668
|
-
|
|
170669
|
-
|
|
170670
|
-
|
|
170671
|
-
|
|
170672
|
-
|
|
170909
|
+
if (project.projectKind !== server.ProjectKind.AutoImportProvider && project.projectKind !== server.ProjectKind.Auxiliary) {
|
|
170910
|
+
var projectName_1 = project.getProjectName();
|
|
170911
|
+
this.pendingProjectUpdates.set(projectName_1, project);
|
|
170912
|
+
this.throttledOperations.schedule(projectName_1, /*delay*/ 250, function () {
|
|
170913
|
+
if (_this.pendingProjectUpdates.delete(projectName_1)) {
|
|
170914
|
+
updateProjectIfDirty(project);
|
|
170915
|
+
}
|
|
170916
|
+
});
|
|
170917
|
+
}
|
|
170673
170918
|
};
|
|
170674
170919
|
/*@internal*/
|
|
170675
170920
|
ProjectService.prototype.hasPendingProjectUpdate = function (project) {
|
|
@@ -172950,7 +173195,7 @@ var ts;
|
|
|
172950
173195
|
var toRemoveScriptInfos = new ts.Map(this.filenameToScriptInfo);
|
|
172951
173196
|
this.filenameToScriptInfo.forEach(function (info) {
|
|
172952
173197
|
// If script info is open or orphan, retain it and its dependencies
|
|
172953
|
-
if (!info.isScriptOpen() && info.isOrphan() && !info.
|
|
173198
|
+
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
172954
173199
|
// Otherwise if there is any source info that is alive, this alive too
|
|
172955
173200
|
if (!info.sourceMapFilePath)
|
|
172956
173201
|
return;
|
|
@@ -174246,6 +174491,9 @@ var ts;
|
|
|
174246
174491
|
_a[server.CommandNames.DefinitionAndBoundSpanFull] = function (request) {
|
|
174247
174492
|
return _this.requiredResponse(_this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
174248
174493
|
},
|
|
174494
|
+
_a[server.CommandNames.FindSourceDefinition] = function (request) {
|
|
174495
|
+
return _this.requiredResponse(_this.findSourceDefinition(request.arguments));
|
|
174496
|
+
},
|
|
174249
174497
|
_a[server.CommandNames.EmitOutput] = function (request) {
|
|
174250
174498
|
return _this.requiredResponse(_this.getEmitOutput(request.arguments));
|
|
174251
174499
|
},
|
|
@@ -174987,7 +175235,7 @@ var ts;
|
|
|
174987
175235
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
174988
175236
|
return definitions.map(function (info) {
|
|
174989
175237
|
var newDocumentSpan = getMappedDocumentSpan(info, project);
|
|
174990
|
-
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name }), info.unverified && { unverified: info.unverified });
|
|
175238
|
+
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name, failedAliasResolution: info.failedAliasResolution }), info.unverified && { unverified: info.unverified });
|
|
174991
175239
|
});
|
|
174992
175240
|
};
|
|
174993
175241
|
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
|
@@ -175014,6 +175262,152 @@ var ts;
|
|
|
175014
175262
|
textSpan: textSpan,
|
|
175015
175263
|
};
|
|
175016
175264
|
};
|
|
175265
|
+
Session.prototype.findSourceDefinition = function (args) {
|
|
175266
|
+
var _a;
|
|
175267
|
+
var _b = this.getFileAndProject(args), file = _b.file, project = _b.project;
|
|
175268
|
+
var position = this.getPositionInFile(args, file);
|
|
175269
|
+
var unmappedDefinitions = project.getLanguageService().getDefinitionAtPosition(file, position);
|
|
175270
|
+
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || server.emptyArray, project).slice();
|
|
175271
|
+
var needsJsResolution = this.projectService.serverMode === ts.LanguageServiceMode.Semantic && (!ts.some(definitions, function (d) { return server.toNormalizedPath(d.fileName) !== file && !d.isAmbient; }) ||
|
|
175272
|
+
ts.some(definitions, function (d) { return !!d.failedAliasResolution; }));
|
|
175273
|
+
if (needsJsResolution) {
|
|
175274
|
+
var definitionSet_1 = ts.createSet(function (d) { return d.textSpan.start; }, ts.documentSpansEqual);
|
|
175275
|
+
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175276
|
+
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175277
|
+
var ls = noDtsProject.getLanguageService();
|
|
175278
|
+
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175279
|
+
if (ts.some(jsDefinitions)) {
|
|
175280
|
+
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175281
|
+
var jsDefinition = jsDefinitions_1[_i];
|
|
175282
|
+
if (jsDefinition.unverified) {
|
|
175283
|
+
var refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram());
|
|
175284
|
+
if (ts.some(refined)) {
|
|
175285
|
+
for (var _c = 0, refined_1 = refined; _c < refined_1.length; _c++) {
|
|
175286
|
+
var def = refined_1[_c];
|
|
175287
|
+
definitionSet_1.add(def);
|
|
175288
|
+
}
|
|
175289
|
+
continue;
|
|
175290
|
+
}
|
|
175291
|
+
}
|
|
175292
|
+
definitionSet_1.add(jsDefinition);
|
|
175293
|
+
}
|
|
175294
|
+
}
|
|
175295
|
+
else {
|
|
175296
|
+
var ambientCandidates = definitions.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; });
|
|
175297
|
+
for (var _d = 0, _e = ts.some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain(); _d < _e.length; _d++) {
|
|
175298
|
+
var candidate = _e[_d];
|
|
175299
|
+
var fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
175300
|
+
if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
|
|
175301
|
+
continue;
|
|
175302
|
+
}
|
|
175303
|
+
var noDtsProgram = ls.getProgram();
|
|
175304
|
+
var fileToSearch = ts.Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
175305
|
+
for (var _f = 0, _g = searchForDeclaration(candidate.name, fileToSearch, noDtsProgram); _f < _g.length; _f++) {
|
|
175306
|
+
var match = _g[_f];
|
|
175307
|
+
definitionSet_1.add(match);
|
|
175308
|
+
}
|
|
175309
|
+
}
|
|
175310
|
+
}
|
|
175311
|
+
definitions = ts.arrayFrom(definitionSet_1.values());
|
|
175312
|
+
}
|
|
175313
|
+
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
175314
|
+
return this.mapDefinitionInfo(definitions, project);
|
|
175315
|
+
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
175316
|
+
var _a;
|
|
175317
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(fileName);
|
|
175318
|
+
if (nodeModulesPathParts && fileName.lastIndexOf(ts.nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
175319
|
+
// Second check ensures the fileName only contains one `/node_modules/`. If there's more than one I give up.
|
|
175320
|
+
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
175321
|
+
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
175322
|
+
var compilerOptions = project.getCompilationSettings();
|
|
175323
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175324
|
+
if (!packageJson)
|
|
175325
|
+
return undefined;
|
|
175326
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node12 or nodenext -
|
|
175327
|
+
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175328
|
+
// resolved from the package root under --moduleResolution node
|
|
175329
|
+
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
175330
|
+
// This substring is correct only because we checked for a single `/node_modules/` at the top.
|
|
175331
|
+
var packageNamePathPart = fileName.substring(nodeModulesPathParts.topLevelPackageNameIndex + 1, nodeModulesPathParts.packageRootIndex);
|
|
175332
|
+
var packageName = ts.getPackageNameFromTypesPackageName(ts.unmangleScopedPackageName(packageNamePathPart));
|
|
175333
|
+
var path_1 = project.toPath(fileName);
|
|
175334
|
+
if (entrypoints && ts.some(entrypoints, function (e) { return project.toPath(e) === path_1; })) {
|
|
175335
|
+
// This file was the main entrypoint of a package. Try to resolve that same package name with
|
|
175336
|
+
// the auxiliary project that only resolves to implementation files.
|
|
175337
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile)[0];
|
|
175338
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175339
|
+
}
|
|
175340
|
+
else {
|
|
175341
|
+
// It wasn't the main entrypoint but we are in node_modules. Try a subpath into the package.
|
|
175342
|
+
var pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
175343
|
+
var specifier = packageName + "/" + ts.removeFileExtension(pathToFileInPackage);
|
|
175344
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile)[0];
|
|
175345
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175346
|
+
}
|
|
175347
|
+
}
|
|
175348
|
+
// We're not in node_modules, and we only get to this function if non-dts module resolution failed.
|
|
175349
|
+
// I'm not sure what else I can do here that isn't already covered by that module resolution.
|
|
175350
|
+
return undefined;
|
|
175351
|
+
}
|
|
175352
|
+
// In 'foo.bar./**/baz', if we got not results on 'baz', see if we can get an ambient definition
|
|
175353
|
+
// for 'bar' or 'foo' (in that order) so we can search for declarations of 'baz' later.
|
|
175354
|
+
function getAmbientCandidatesByClimbingAccessChain() {
|
|
175355
|
+
var ls = project.getLanguageService();
|
|
175356
|
+
var program = ls.getProgram();
|
|
175357
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175358
|
+
if ((ts.isStringLiteralLike(initialNode) || ts.isIdentifier(initialNode)) && ts.isAccessExpression(initialNode.parent)) {
|
|
175359
|
+
return ts.forEachNameInAccessChainWalkingLeft(initialNode, function (nameInChain) {
|
|
175360
|
+
var _a;
|
|
175361
|
+
if (nameInChain === initialNode)
|
|
175362
|
+
return undefined;
|
|
175363
|
+
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175364
|
+
fileName: d.fileName,
|
|
175365
|
+
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175366
|
+
}); });
|
|
175367
|
+
if (ts.some(candidates)) {
|
|
175368
|
+
return candidates;
|
|
175369
|
+
}
|
|
175370
|
+
}) || server.emptyArray;
|
|
175371
|
+
}
|
|
175372
|
+
return server.emptyArray;
|
|
175373
|
+
}
|
|
175374
|
+
function tryRefineDefinition(definition, program, noDtsProgram) {
|
|
175375
|
+
var _a;
|
|
175376
|
+
var fileToSearch = noDtsProgram.getSourceFile(definition.fileName);
|
|
175377
|
+
if (!fileToSearch) {
|
|
175378
|
+
return undefined;
|
|
175379
|
+
}
|
|
175380
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175381
|
+
var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode);
|
|
175382
|
+
var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* ImportSpecifier */);
|
|
175383
|
+
if (!importSpecifier)
|
|
175384
|
+
return undefined;
|
|
175385
|
+
var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text;
|
|
175386
|
+
return searchForDeclaration(nameToSearch, fileToSearch, noDtsProgram);
|
|
175387
|
+
}
|
|
175388
|
+
function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
|
|
175389
|
+
var matches = ts.FindAllReferences.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
|
|
175390
|
+
return ts.mapDefined(matches, function (match) {
|
|
175391
|
+
var symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
|
|
175392
|
+
var decl = ts.getDeclarationFromName(match);
|
|
175393
|
+
if (symbol && decl) {
|
|
175394
|
+
// I think the last argument to this is supposed to be the start node, but it doesn't seem important.
|
|
175395
|
+
// Callers internal to GoToDefinition already get confused about this.
|
|
175396
|
+
return ts.GoToDefinition.createDefinitionInfo(decl, noDtsProgram.getTypeChecker(), symbol, decl, /*unverified*/ true);
|
|
175397
|
+
}
|
|
175398
|
+
});
|
|
175399
|
+
}
|
|
175400
|
+
function ensureRoot(project, fileName) {
|
|
175401
|
+
var info = project.getScriptInfo(fileName);
|
|
175402
|
+
if (!info)
|
|
175403
|
+
return false;
|
|
175404
|
+
if (!project.containsScriptInfo(info)) {
|
|
175405
|
+
project.addRoot(info);
|
|
175406
|
+
project.updateGraph();
|
|
175407
|
+
}
|
|
175408
|
+
return true;
|
|
175409
|
+
}
|
|
175410
|
+
};
|
|
175017
175411
|
Session.prototype.getEmitOutput = function (args) {
|
|
175018
175412
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
175019
175413
|
if (!project.shouldEmitFile(project.getScriptInfo(file))) {
|
|
@@ -175577,7 +175971,7 @@ var ts;
|
|
|
175577
175971
|
return undefined;
|
|
175578
175972
|
}
|
|
175579
175973
|
var compilationSettings = project.getCompilationSettings();
|
|
175580
|
-
if (!!compilationSettings.noEmit || ts.
|
|
175974
|
+
if (!!compilationSettings.noEmit || ts.isDeclarationFileName(info.fileName) && !dtsChangeCanAffectEmit(compilationSettings)) {
|
|
175581
175975
|
// avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
|
|
175582
175976
|
return undefined;
|
|
175583
175977
|
}
|
|
@@ -176057,7 +176451,7 @@ var ts;
|
|
|
176057
176451
|
else {
|
|
176058
176452
|
var info = this.projectService.getScriptInfo(fileNameInProject); // TODO: GH#18217
|
|
176059
176453
|
if (!info.isScriptOpen()) {
|
|
176060
|
-
if (ts.
|
|
176454
|
+
if (ts.isDeclarationFileName(fileNameInProject)) {
|
|
176061
176455
|
veryLowPriorityFiles.push(fileNameInProject);
|
|
176062
176456
|
}
|
|
176063
176457
|
else {
|