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/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220416";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -4854,7 +4854,6 @@ var ts;
|
|
|
4854
4854
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4855
4855
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4856
4856
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4857
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4858
4857
|
// Error handling
|
|
4859
4858
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4860
4859
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8911,6 +8910,7 @@ var ts;
|
|
|
8911
8910
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8912
8911
|
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."),
|
|
8913
8912
|
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."),
|
|
8913
|
+
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."),
|
|
8914
8914
|
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."),
|
|
8915
8915
|
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."),
|
|
8916
8916
|
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."),
|
|
@@ -15159,6 +15159,10 @@ var ts;
|
|
|
15159
15159
|
}
|
|
15160
15160
|
}
|
|
15161
15161
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
15162
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
15163
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
15164
|
+
}
|
|
15165
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
15162
15166
|
function isLateVisibilityPaintedStatement(node) {
|
|
15163
15167
|
switch (node.kind) {
|
|
15164
15168
|
case 266 /* ImportDeclaration */:
|
|
@@ -16519,17 +16523,13 @@ var ts;
|
|
|
16519
16523
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16520
16524
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16521
16525
|
}
|
|
16522
|
-
if (ts.
|
|
16526
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16523
16527
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16524
16528
|
ts.isIdentifier(initializer.expression) &&
|
|
16525
16529
|
(initializer.expression.escapedText === "window" ||
|
|
16526
16530
|
initializer.expression.escapedText === "self" ||
|
|
16527
16531
|
initializer.expression.escapedText === "global"))) {
|
|
16528
|
-
|
|
16529
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16530
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16531
|
-
}
|
|
16532
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16532
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16533
16533
|
}
|
|
16534
16534
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16535
16535
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16737,14 +16737,14 @@ var ts;
|
|
|
16737
16737
|
}
|
|
16738
16738
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16739
16739
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16740
|
-
var _a, _b
|
|
16740
|
+
var _a, _b;
|
|
16741
16741
|
switch (node.kind) {
|
|
16742
16742
|
case 254 /* VariableDeclaration */:
|
|
16743
|
-
return node.initializer.arguments[0]
|
|
16743
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16744
16744
|
case 266 /* ImportDeclaration */:
|
|
16745
|
-
return
|
|
16745
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16746
16746
|
case 265 /* ImportEqualsDeclaration */:
|
|
16747
|
-
return
|
|
16747
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16748
16748
|
default:
|
|
16749
16749
|
ts.Debug.assertNever(node);
|
|
16750
16750
|
}
|
|
@@ -17259,7 +17259,10 @@ var ts;
|
|
|
17259
17259
|
return parent.propertyName === node;
|
|
17260
17260
|
case 275 /* ExportSpecifier */:
|
|
17261
17261
|
case 285 /* JsxAttribute */:
|
|
17262
|
-
|
|
17262
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17263
|
+
case 280 /* JsxOpeningElement */:
|
|
17264
|
+
case 281 /* JsxClosingElement */:
|
|
17265
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17263
17266
|
return true;
|
|
17264
17267
|
}
|
|
17265
17268
|
return false;
|
|
@@ -17275,21 +17278,28 @@ var ts;
|
|
|
17275
17278
|
// export = <EntityNameExpression>
|
|
17276
17279
|
// export default <EntityNameExpression>
|
|
17277
17280
|
// module.exports = <EntityNameExpression>
|
|
17278
|
-
//
|
|
17279
|
-
//
|
|
17281
|
+
// module.exports.x = <EntityNameExpression>
|
|
17282
|
+
// const x = require("...")
|
|
17283
|
+
// const { x } = require("...")
|
|
17284
|
+
// const x = require("...").y
|
|
17285
|
+
// const { x } = require("...").y
|
|
17280
17286
|
function isAliasSymbolDeclaration(node) {
|
|
17281
|
-
|
|
17287
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17282
17288
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17283
17289
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17284
17290
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17285
17291
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17286
17292
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17287
17293
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17288
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17294
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17295
|
+
return true;
|
|
17296
|
+
}
|
|
17297
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17298
|
+
ts.isPropertyAccessExpression(node)
|
|
17299
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17300
|
+
&& node.parent.left === node
|
|
17301
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17302
|
+
&& isAliasableExpression(node.parent.right));
|
|
17293
17303
|
}
|
|
17294
17304
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17295
17305
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17300,6 +17310,7 @@ var ts;
|
|
|
17300
17310
|
case 275 /* ExportSpecifier */:
|
|
17301
17311
|
case 271 /* ExportAssignment */:
|
|
17302
17312
|
case 265 /* ImportEqualsDeclaration */:
|
|
17313
|
+
case 274 /* NamespaceExport */:
|
|
17303
17314
|
return node.parent;
|
|
17304
17315
|
case 161 /* QualifiedName */:
|
|
17305
17316
|
do {
|
|
@@ -19126,6 +19137,11 @@ var ts;
|
|
|
19126
19137
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
19127
19138
|
}
|
|
19128
19139
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
19140
|
+
function isRightSideOfAccessExpression(node) {
|
|
19141
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
19142
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
19143
|
+
}
|
|
19144
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
19129
19145
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
19130
19146
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
19131
19147
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19777,6 +19793,41 @@ var ts;
|
|
|
19777
19793
|
return expr;
|
|
19778
19794
|
}
|
|
19779
19795
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19796
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19797
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19798
|
+
return walkAccessExpression(name.parent);
|
|
19799
|
+
}
|
|
19800
|
+
function walkAccessExpression(access) {
|
|
19801
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19802
|
+
var res = action(access.name);
|
|
19803
|
+
if (res !== undefined) {
|
|
19804
|
+
return res;
|
|
19805
|
+
}
|
|
19806
|
+
}
|
|
19807
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19808
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19809
|
+
var res = action(access.argumentExpression);
|
|
19810
|
+
if (res !== undefined) {
|
|
19811
|
+
return res;
|
|
19812
|
+
}
|
|
19813
|
+
}
|
|
19814
|
+
else {
|
|
19815
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19816
|
+
return undefined;
|
|
19817
|
+
}
|
|
19818
|
+
}
|
|
19819
|
+
if (isAccessExpression(access.expression)) {
|
|
19820
|
+
return walkAccessExpression(access.expression);
|
|
19821
|
+
}
|
|
19822
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19823
|
+
// End of chain at Identifier 'x.y.z'
|
|
19824
|
+
return action(access.expression);
|
|
19825
|
+
}
|
|
19826
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19827
|
+
return undefined;
|
|
19828
|
+
}
|
|
19829
|
+
}
|
|
19830
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19780
19831
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19781
19832
|
while (true) {
|
|
19782
19833
|
switch (node.kind) {
|
|
@@ -20724,6 +20775,7 @@ var ts;
|
|
|
20724
20775
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20725
20776
|
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 */]];
|
|
20726
20777
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20778
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20727
20779
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20728
20780
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20729
20781
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21412,6 +21464,11 @@ var ts;
|
|
|
21412
21464
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21413
21465
|
}
|
|
21414
21466
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21467
|
+
function getParameterTypeNode(parameter) {
|
|
21468
|
+
var _a;
|
|
21469
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21470
|
+
}
|
|
21471
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21415
21472
|
})(ts || (ts = {}));
|
|
21416
21473
|
/* @internal */
|
|
21417
21474
|
var ts;
|
|
@@ -35565,34 +35622,10 @@ var ts;
|
|
|
35565
35622
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35566
35623
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35567
35624
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35568
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35569
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35570
|
-
// expression.
|
|
35571
|
-
// falls through
|
|
35572
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35573
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35574
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35575
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35576
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35577
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35578
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35579
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35580
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35581
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35582
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35583
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35584
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35585
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35586
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35587
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35588
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35589
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35590
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35591
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35592
35625
|
return true;
|
|
35593
35626
|
}
|
|
35594
|
-
//
|
|
35595
|
-
return
|
|
35627
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35628
|
+
return !isStartOfExpression();
|
|
35596
35629
|
}
|
|
35597
35630
|
function parsePrimaryExpression() {
|
|
35598
35631
|
switch (token()) {
|
|
@@ -38810,7 +38843,7 @@ var ts;
|
|
|
38810
38843
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38811
38844
|
/** @internal */
|
|
38812
38845
|
function isDeclarationFileName(fileName) {
|
|
38813
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38846
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38814
38847
|
}
|
|
38815
38848
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38816
38849
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42318,7 +42351,8 @@ var ts;
|
|
|
42318
42351
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42319
42352
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42320
42353
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42321
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42354
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42355
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42322
42356
|
})(Extensions || (Extensions = {}));
|
|
42323
42357
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42324
42358
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43263,7 +43297,21 @@ var ts;
|
|
|
43263
43297
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43264
43298
|
}
|
|
43265
43299
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43266
|
-
|
|
43300
|
+
var extensions;
|
|
43301
|
+
if (lookupConfig) {
|
|
43302
|
+
extensions = tsconfigExtensions;
|
|
43303
|
+
}
|
|
43304
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43305
|
+
extensions = [Extensions.TsOnly];
|
|
43306
|
+
if (compilerOptions.allowJs)
|
|
43307
|
+
extensions.push(Extensions.JavaScript);
|
|
43308
|
+
if (compilerOptions.resolveJsonModule)
|
|
43309
|
+
extensions.push(Extensions.Json);
|
|
43310
|
+
}
|
|
43311
|
+
else {
|
|
43312
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43313
|
+
}
|
|
43314
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43267
43315
|
}
|
|
43268
43316
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43269
43317
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43272,6 +43320,10 @@ var ts;
|
|
|
43272
43320
|
var failedLookupLocations = [];
|
|
43273
43321
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43274
43322
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43323
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43324
|
+
if (compilerOptions.noDtsResolution) {
|
|
43325
|
+
conditions.pop();
|
|
43326
|
+
}
|
|
43275
43327
|
var state = {
|
|
43276
43328
|
compilerOptions: compilerOptions,
|
|
43277
43329
|
host: host,
|
|
@@ -43279,7 +43331,7 @@ var ts;
|
|
|
43279
43331
|
failedLookupLocations: failedLookupLocations,
|
|
43280
43332
|
packageJsonInfoCache: cache,
|
|
43281
43333
|
features: features,
|
|
43282
|
-
conditions:
|
|
43334
|
+
conditions: conditions,
|
|
43283
43335
|
};
|
|
43284
43336
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43285
43337
|
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);
|
|
@@ -43455,9 +43507,9 @@ var ts;
|
|
|
43455
43507
|
}
|
|
43456
43508
|
}
|
|
43457
43509
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43458
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43510
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43459
43511
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43460
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43512
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43461
43513
|
}
|
|
43462
43514
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43463
43515
|
}
|
|
@@ -43487,20 +43539,22 @@ var ts;
|
|
|
43487
43539
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43488
43540
|
}
|
|
43489
43541
|
case Extensions.TypeScript:
|
|
43542
|
+
case Extensions.TsOnly:
|
|
43543
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43490
43544
|
switch (originalExtension) {
|
|
43491
43545
|
case ".mjs" /* Mjs */:
|
|
43492
43546
|
case ".mts" /* Mts */:
|
|
43493
43547
|
case ".d.mts" /* Dmts */:
|
|
43494
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43548
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43495
43549
|
case ".cjs" /* Cjs */:
|
|
43496
43550
|
case ".cts" /* Cts */:
|
|
43497
43551
|
case ".d.cts" /* Dcts */:
|
|
43498
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43552
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43499
43553
|
case ".json" /* Json */:
|
|
43500
43554
|
candidate += ".json" /* Json */;
|
|
43501
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43555
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43502
43556
|
default:
|
|
43503
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43557
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43504
43558
|
}
|
|
43505
43559
|
case Extensions.JavaScript:
|
|
43506
43560
|
switch (originalExtension) {
|
|
@@ -43727,6 +43781,7 @@ var ts;
|
|
|
43727
43781
|
switch (extensions) {
|
|
43728
43782
|
case Extensions.JavaScript:
|
|
43729
43783
|
case Extensions.Json:
|
|
43784
|
+
case Extensions.TsOnly:
|
|
43730
43785
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43731
43786
|
break;
|
|
43732
43787
|
case Extensions.TypeScript:
|
|
@@ -43799,14 +43854,16 @@ var ts;
|
|
|
43799
43854
|
function extensionIsOk(extensions, extension) {
|
|
43800
43855
|
switch (extensions) {
|
|
43801
43856
|
case Extensions.JavaScript:
|
|
43802
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43857
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43803
43858
|
case Extensions.TSConfig:
|
|
43804
43859
|
case Extensions.Json:
|
|
43805
43860
|
return extension === ".json" /* Json */;
|
|
43806
43861
|
case Extensions.TypeScript:
|
|
43807
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43862
|
+
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 */;
|
|
43863
|
+
case Extensions.TsOnly:
|
|
43864
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43808
43865
|
case Extensions.DtsOnly:
|
|
43809
|
-
return extension === ".d.ts" /* Dts */;
|
|
43866
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43810
43867
|
}
|
|
43811
43868
|
}
|
|
43812
43869
|
/* @internal */
|
|
@@ -45966,6 +46023,7 @@ var ts;
|
|
|
45966
46023
|
case 261 /* ModuleDeclaration */:
|
|
45967
46024
|
case 259 /* TypeAliasDeclaration */:
|
|
45968
46025
|
case 195 /* MappedType */:
|
|
46026
|
+
case 176 /* IndexSignature */:
|
|
45969
46027
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45970
46028
|
case 305 /* SourceFile */:
|
|
45971
46029
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45984,7 +46042,6 @@ var ts;
|
|
|
45984
46042
|
case 317 /* JSDocFunctionType */:
|
|
45985
46043
|
case 179 /* FunctionType */:
|
|
45986
46044
|
case 175 /* ConstructSignature */:
|
|
45987
|
-
case 176 /* IndexSignature */:
|
|
45988
46045
|
case 180 /* ConstructorType */:
|
|
45989
46046
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45990
46047
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50562,27 +50619,27 @@ var ts;
|
|
|
50562
50619
|
function resolveAlias(symbol) {
|
|
50563
50620
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50564
50621
|
var links = getSymbolLinks(symbol);
|
|
50565
|
-
if (!links.
|
|
50566
|
-
links.
|
|
50622
|
+
if (!links.aliasTarget) {
|
|
50623
|
+
links.aliasTarget = resolvingSymbol;
|
|
50567
50624
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50568
50625
|
if (!node)
|
|
50569
50626
|
return ts.Debug.fail();
|
|
50570
50627
|
var target = getTargetOfAliasDeclaration(node);
|
|
50571
|
-
if (links.
|
|
50572
|
-
links.
|
|
50628
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50629
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50573
50630
|
}
|
|
50574
50631
|
else {
|
|
50575
50632
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50576
50633
|
}
|
|
50577
50634
|
}
|
|
50578
|
-
else if (links.
|
|
50579
|
-
links.
|
|
50635
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50636
|
+
links.aliasTarget = unknownSymbol;
|
|
50580
50637
|
}
|
|
50581
|
-
return links.
|
|
50638
|
+
return links.aliasTarget;
|
|
50582
50639
|
}
|
|
50583
50640
|
function tryResolveAlias(symbol) {
|
|
50584
50641
|
var links = getSymbolLinks(symbol);
|
|
50585
|
-
if (links.
|
|
50642
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50586
50643
|
return resolveAlias(symbol);
|
|
50587
50644
|
}
|
|
50588
50645
|
return undefined;
|
|
@@ -52379,13 +52436,37 @@ var ts;
|
|
|
52379
52436
|
return ts.Debug.fail("Should be unreachable.");
|
|
52380
52437
|
function conditionalTypeToTypeNode(type) {
|
|
52381
52438
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52439
|
+
context.approximateLength += 15;
|
|
52440
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52441
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52442
|
+
var name = typeParameterToName(newParam, context);
|
|
52443
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52444
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52445
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52446
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52447
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52448
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52449
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52450
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52451
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52452
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52453
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52454
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52455
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52456
|
+
// this is potentially simplifiable to
|
|
52457
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52458
|
+
// but that may confuse users who read the output more.
|
|
52459
|
+
// On the other hand,
|
|
52460
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52461
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52462
|
+
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 */));
|
|
52463
|
+
}
|
|
52382
52464
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52383
52465
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52384
52466
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52385
52467
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52386
52468
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52387
52469
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52388
|
-
context.approximateLength += 15;
|
|
52389
52470
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52390
52471
|
}
|
|
52391
52472
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -53084,9 +53165,6 @@ var ts;
|
|
|
53084
53165
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
53085
53166
|
parameterType = getOptionalType(parameterType);
|
|
53086
53167
|
}
|
|
53087
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
53088
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
53089
|
-
}
|
|
53090
53168
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
53091
53169
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
53092
53170
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53645,7 +53723,7 @@ var ts;
|
|
|
53645
53723
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53646
53724
|
// try to reuse the existing annotation
|
|
53647
53725
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53648
|
-
if (
|
|
53726
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53649
53727
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53650
53728
|
if (result_6) {
|
|
53651
53729
|
return result_6;
|
|
@@ -53662,6 +53740,16 @@ var ts;
|
|
|
53662
53740
|
context.flags = oldFlags;
|
|
53663
53741
|
return result;
|
|
53664
53742
|
}
|
|
53743
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53744
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53745
|
+
if (typeFromTypeNode === type) {
|
|
53746
|
+
return true;
|
|
53747
|
+
}
|
|
53748
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53749
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53750
|
+
}
|
|
53751
|
+
return false;
|
|
53752
|
+
}
|
|
53665
53753
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53666
53754
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53667
53755
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55933,7 +56021,7 @@ var ts;
|
|
|
55933
56021
|
}
|
|
55934
56022
|
}
|
|
55935
56023
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55936
|
-
type = getUnionType(sourceTypes
|
|
56024
|
+
type = getUnionType(sourceTypes);
|
|
55937
56025
|
}
|
|
55938
56026
|
}
|
|
55939
56027
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58682,8 +58770,9 @@ var ts;
|
|
|
58682
58770
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58683
58771
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58684
58772
|
// nesting, so it is effectively just a safety stop.
|
|
58685
|
-
|
|
58686
|
-
|
|
58773
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58774
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58775
|
+
stack.push(identity_1);
|
|
58687
58776
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58688
58777
|
stack.pop();
|
|
58689
58778
|
}
|
|
@@ -66881,12 +66970,12 @@ var ts;
|
|
|
66881
66970
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66882
66971
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66883
66972
|
if (depth >= maxDepth) {
|
|
66884
|
-
var
|
|
66973
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66885
66974
|
var count = 0;
|
|
66886
66975
|
var lastTypeId = 0;
|
|
66887
66976
|
for (var i = 0; i < depth; i++) {
|
|
66888
66977
|
var t = stack[i];
|
|
66889
|
-
if (getRecursionIdentity(t) ===
|
|
66978
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66890
66979
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66891
66980
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66892
66981
|
if (t.id >= lastTypeId) {
|
|
@@ -76888,7 +76977,7 @@ var ts;
|
|
|
76888
76977
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76889
76978
|
newSymbol.parent = originalSymbol;
|
|
76890
76979
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76891
|
-
newSymbol.
|
|
76980
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76892
76981
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76893
76982
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76894
76983
|
}
|
|
@@ -79700,19 +79789,28 @@ var ts;
|
|
|
79700
79789
|
if (constraintType && defaultType) {
|
|
79701
79790
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79702
79791
|
}
|
|
79703
|
-
|
|
79792
|
+
checkNodeDeferred(node);
|
|
79793
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79794
|
+
}
|
|
79795
|
+
function checkTypeParameterDeferred(node) {
|
|
79796
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79797
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79704
79798
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79705
|
-
if (modifiers
|
|
79799
|
+
if (modifiers) {
|
|
79706
79800
|
var symbol = getSymbolOfNode(node.parent);
|
|
79707
|
-
|
|
79708
|
-
|
|
79709
|
-
|
|
79710
|
-
|
|
79711
|
-
|
|
79712
|
-
|
|
79801
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79802
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79803
|
+
}
|
|
79804
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79805
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79806
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79807
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79808
|
+
varianceTypeParameter = typeParameter;
|
|
79809
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79810
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79811
|
+
}
|
|
79713
79812
|
}
|
|
79714
79813
|
}
|
|
79715
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79716
79814
|
}
|
|
79717
79815
|
function checkParameter(node) {
|
|
79718
79816
|
// Grammar checking
|
|
@@ -80202,7 +80300,7 @@ var ts;
|
|
|
80202
80300
|
superCallStatement = statement;
|
|
80203
80301
|
break;
|
|
80204
80302
|
}
|
|
80205
|
-
if (
|
|
80303
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80206
80304
|
break;
|
|
80207
80305
|
}
|
|
80208
80306
|
}
|
|
@@ -85555,6 +85653,9 @@ var ts;
|
|
|
85555
85653
|
case 226 /* ClassExpression */:
|
|
85556
85654
|
checkClassExpressionDeferred(node);
|
|
85557
85655
|
break;
|
|
85656
|
+
case 163 /* TypeParameter */:
|
|
85657
|
+
checkTypeParameterDeferred(node);
|
|
85658
|
+
break;
|
|
85558
85659
|
case 279 /* JsxSelfClosingElement */:
|
|
85559
85660
|
checkJsxSelfClosingElementDeferred(node);
|
|
85560
85661
|
break;
|
|
@@ -86369,11 +86470,11 @@ var ts;
|
|
|
86369
86470
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86370
86471
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86371
86472
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86372
|
-
: ts.singleElementArray(
|
|
86473
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86373
86474
|
}
|
|
86374
86475
|
return undefined;
|
|
86375
86476
|
}
|
|
86376
|
-
function
|
|
86477
|
+
function tryGetTarget(symbol) {
|
|
86377
86478
|
var target;
|
|
86378
86479
|
var next = symbol;
|
|
86379
86480
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86603,7 +86704,7 @@ var ts;
|
|
|
86603
86704
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86604
86705
|
return true;
|
|
86605
86706
|
}
|
|
86606
|
-
var target = getSymbolLinks(symbol).
|
|
86707
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86607
86708
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86608
86709
|
target.flags & 111551 /* Value */ &&
|
|
86609
86710
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86651,11 +86752,6 @@ var ts;
|
|
|
86651
86752
|
!parameter.initializer &&
|
|
86652
86753
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86653
86754
|
}
|
|
86654
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86655
|
-
return !!strictNullChecks &&
|
|
86656
|
-
isOptionalParameter(parameter) &&
|
|
86657
|
-
!parameter.initializer;
|
|
86658
|
-
}
|
|
86659
86755
|
function isExpandoFunctionDeclaration(node) {
|
|
86660
86756
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86661
86757
|
if (!declaration) {
|
|
@@ -87572,8 +87668,7 @@ var ts;
|
|
|
87572
87668
|
case 144 /* OutKeyword */:
|
|
87573
87669
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87574
87670
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87575
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87576
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87671
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87577
87672
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87578
87673
|
}
|
|
87579
87674
|
if (flags & inOutFlag) {
|
|
@@ -92807,11 +92902,11 @@ var ts;
|
|
|
92807
92902
|
}
|
|
92808
92903
|
var statements = [];
|
|
92809
92904
|
resumeLexicalEnvironment();
|
|
92810
|
-
var
|
|
92811
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92905
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92906
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92812
92907
|
// If there was a super call, visit existing statements up to and including it
|
|
92813
92908
|
if (superStatementIndex >= 0) {
|
|
92814
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92909
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92815
92910
|
}
|
|
92816
92911
|
// Transform parameters into property assignments. Transforms this:
|
|
92817
92912
|
//
|
|
@@ -92830,12 +92925,12 @@ var ts;
|
|
|
92830
92925
|
if (superStatementIndex >= 0) {
|
|
92831
92926
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92832
92927
|
}
|
|
92833
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92928
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92834
92929
|
else {
|
|
92835
|
-
statements =
|
|
92930
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92836
92931
|
}
|
|
92837
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92838
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92932
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92933
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92839
92934
|
// End the lexical environment.
|
|
92840
92935
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92841
92936
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -108599,6 +108694,10 @@ var ts;
|
|
|
108599
108694
|
return factory.updateModifiers(statement, modifiers);
|
|
108600
108695
|
}
|
|
108601
108696
|
function transformTopLevelDeclaration(input) {
|
|
108697
|
+
if (lateMarkedStatements) {
|
|
108698
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108699
|
+
;
|
|
108700
|
+
}
|
|
108602
108701
|
if (shouldStripInternal(input))
|
|
108603
108702
|
return;
|
|
108604
108703
|
switch (input.kind) {
|
|
@@ -109730,7 +109829,7 @@ var ts;
|
|
|
109730
109829
|
addOutput(buildInfoPath);
|
|
109731
109830
|
}
|
|
109732
109831
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109733
|
-
if (ts.
|
|
109832
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109734
109833
|
return;
|
|
109735
109834
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109736
109835
|
addOutput(js);
|
|
@@ -109775,7 +109874,7 @@ var ts;
|
|
|
109775
109874
|
/*@internal*/
|
|
109776
109875
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109777
109876
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109778
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109877
|
+
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));
|
|
109779
109878
|
}
|
|
109780
109879
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109781
109880
|
/*@internal*/
|
|
@@ -109817,7 +109916,7 @@ var ts;
|
|
|
109817
109916
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109818
109917
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109819
109918
|
var inputFileName = _b[_a];
|
|
109820
|
-
if (ts.
|
|
109919
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109821
109920
|
continue;
|
|
109822
109921
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109823
109922
|
if (jsFilePath)
|
|
@@ -115167,7 +115266,7 @@ var ts;
|
|
|
115167
115266
|
if (ts.outFile(options) || options.outDir)
|
|
115168
115267
|
return false;
|
|
115169
115268
|
// File if emitted next to input needs to be ignored
|
|
115170
|
-
if (ts.
|
|
115269
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
115171
115270
|
// If its declaration directory: its not ignored if not excluded by config
|
|
115172
115271
|
if (options.declarationDir)
|
|
115173
115272
|
return false;
|
|
@@ -116340,7 +116439,7 @@ var ts;
|
|
|
116340
116439
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116341
116440
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116342
116441
|
var fileName = _c[_b];
|
|
116343
|
-
if (!ts.
|
|
116442
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116344
116443
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116345
116444
|
}
|
|
116346
116445
|
}
|
|
@@ -116531,7 +116630,7 @@ var ts;
|
|
|
116531
116630
|
}
|
|
116532
116631
|
function getRedirectReferenceForResolution(file) {
|
|
116533
116632
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116534
|
-
if (redirect || !ts.
|
|
116633
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116535
116634
|
return redirect;
|
|
116536
116635
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116537
116636
|
// 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
|
|
@@ -117922,7 +118021,7 @@ var ts;
|
|
|
117922
118021
|
}
|
|
117923
118022
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117924
118023
|
// Ignore dts or any json files
|
|
117925
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
118024
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117926
118025
|
return undefined;
|
|
117927
118026
|
}
|
|
117928
118027
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117971,7 +118070,7 @@ var ts;
|
|
|
117971
118070
|
else {
|
|
117972
118071
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117973
118072
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117974
|
-
if (!ts.
|
|
118073
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117975
118074
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117976
118075
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117977
118076
|
}
|
|
@@ -118772,7 +118871,7 @@ var ts;
|
|
|
118772
118871
|
if (options.outDir) {
|
|
118773
118872
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118774
118873
|
}
|
|
118775
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118874
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118776
118875
|
// Otherwise just check if sourceFile with the name exists
|
|
118777
118876
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118778
118877
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -119105,13 +119204,9 @@ var ts;
|
|
|
119105
119204
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
119106
119205
|
var BuilderState;
|
|
119107
119206
|
(function (BuilderState) {
|
|
119108
|
-
var manyToManyPathMapCount = 0;
|
|
119109
119207
|
function createManyToManyPathMap() {
|
|
119110
119208
|
function create(forward, reverse, deleted) {
|
|
119111
|
-
var version = 0;
|
|
119112
119209
|
var map = {
|
|
119113
|
-
id: manyToManyPathMapCount++,
|
|
119114
|
-
version: function () { return version; },
|
|
119115
119210
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
119116
119211
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
119117
119212
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -119127,30 +119222,29 @@ var ts;
|
|
|
119127
119222
|
}
|
|
119128
119223
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
119129
119224
|
forward.delete(k);
|
|
119130
|
-
version++;
|
|
119131
119225
|
return true;
|
|
119132
119226
|
},
|
|
119133
119227
|
set: function (k, vSet) {
|
|
119134
|
-
|
|
119228
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
119135
119229
|
var existingVSet = forward.get(k);
|
|
119136
119230
|
forward.set(k, vSet);
|
|
119137
119231
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
119138
119232
|
if (!vSet.has(v)) {
|
|
119139
|
-
changed = true;
|
|
119140
119233
|
deleteFromMultimap(reverse, v, k);
|
|
119141
119234
|
}
|
|
119142
119235
|
});
|
|
119143
119236
|
vSet.forEach(function (v) {
|
|
119144
119237
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
119145
|
-
changed = true;
|
|
119146
119238
|
addToMultimap(reverse, v, k);
|
|
119147
119239
|
}
|
|
119148
119240
|
});
|
|
119149
|
-
if (changed) {
|
|
119150
|
-
version++;
|
|
119151
|
-
}
|
|
119152
119241
|
return map;
|
|
119153
119242
|
},
|
|
119243
|
+
clear: function () {
|
|
119244
|
+
forward.clear();
|
|
119245
|
+
reverse.clear();
|
|
119246
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119247
|
+
}
|
|
119154
119248
|
};
|
|
119155
119249
|
return map;
|
|
119156
119250
|
}
|
|
@@ -119165,11 +119259,10 @@ var ts;
|
|
|
119165
119259
|
}
|
|
119166
119260
|
set.add(v);
|
|
119167
119261
|
}
|
|
119168
|
-
function deleteFromMultimap(map, k, v
|
|
119169
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119262
|
+
function deleteFromMultimap(map, k, v) {
|
|
119170
119263
|
var set = map.get(k);
|
|
119171
119264
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
119172
|
-
if (
|
|
119265
|
+
if (!set.size) {
|
|
119173
119266
|
map.delete(k);
|
|
119174
119267
|
}
|
|
119175
119268
|
return true;
|
|
@@ -119398,7 +119491,7 @@ var ts;
|
|
|
119398
119491
|
/*forceDtsEmit*/ true);
|
|
119399
119492
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119400
119493
|
if (firstDts_1) {
|
|
119401
|
-
ts.Debug.assert(ts.
|
|
119494
|
+
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; })); });
|
|
119402
119495
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119403
119496
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119404
119497
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119456,20 +119549,6 @@ var ts;
|
|
|
119456
119549
|
var _a;
|
|
119457
119550
|
if (exportedModulesMapCache) {
|
|
119458
119551
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119459
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119460
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119461
|
-
if (state.previousCache) {
|
|
119462
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119463
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119464
|
-
// was updated, there's no need to update again
|
|
119465
|
-
return;
|
|
119466
|
-
}
|
|
119467
|
-
state.previousCache.id = cacheId;
|
|
119468
|
-
state.previousCache.version = cacheVersion;
|
|
119469
|
-
}
|
|
119470
|
-
else {
|
|
119471
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119472
|
-
}
|
|
119473
119552
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119474
119553
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119475
119554
|
}
|
|
@@ -119803,7 +119882,8 @@ var ts;
|
|
|
119803
119882
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119804
119883
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119805
119884
|
*/
|
|
119806
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119885
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119886
|
+
var _a;
|
|
119807
119887
|
while (true) {
|
|
119808
119888
|
var affectedFiles = state.affectedFiles;
|
|
119809
119889
|
if (affectedFiles) {
|
|
@@ -119814,7 +119894,7 @@ var ts;
|
|
|
119814
119894
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119815
119895
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119816
119896
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119817
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119897
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119818
119898
|
return affectedFile;
|
|
119819
119899
|
}
|
|
119820
119900
|
affectedFilesIndex++;
|
|
@@ -119826,6 +119906,7 @@ var ts;
|
|
|
119826
119906
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119827
119907
|
state.currentAffectedFilesSignatures.clear();
|
|
119828
119908
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119909
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119829
119910
|
state.affectedFiles = undefined;
|
|
119830
119911
|
}
|
|
119831
119912
|
// Get next changed file
|
|
@@ -119855,6 +119936,11 @@ var ts;
|
|
|
119855
119936
|
state.seenAffectedFiles = new ts.Set();
|
|
119856
119937
|
}
|
|
119857
119938
|
}
|
|
119939
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119940
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119941
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119942
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119943
|
+
}
|
|
119858
119944
|
/**
|
|
119859
119945
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119860
119946
|
*/
|
|
@@ -119874,9 +119960,7 @@ var ts;
|
|
|
119874
119960
|
}
|
|
119875
119961
|
}
|
|
119876
119962
|
}
|
|
119877
|
-
state
|
|
119878
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119879
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119963
|
+
clearAffectedFilesPendingEmit(state);
|
|
119880
119964
|
}
|
|
119881
119965
|
return undefined;
|
|
119882
119966
|
}
|
|
@@ -119884,7 +119968,7 @@ var ts;
|
|
|
119884
119968
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119885
119969
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119886
119970
|
*/
|
|
119887
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119971
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119888
119972
|
var _a;
|
|
119889
119973
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119890
119974
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119909,14 +119993,14 @@ var ts;
|
|
|
119909
119993
|
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);
|
|
119910
119994
|
}
|
|
119911
119995
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119912
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119996
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119913
119997
|
}
|
|
119914
119998
|
}
|
|
119915
119999
|
/**
|
|
119916
120000
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119917
120001
|
* Also we need to make sure signature is updated for these files
|
|
119918
120002
|
*/
|
|
119919
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
120003
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119920
120004
|
removeSemanticDiagnosticsOf(state, path);
|
|
119921
120005
|
if (!state.changedFilesSet.has(path)) {
|
|
119922
120006
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119927,8 +120011,7 @@ var ts;
|
|
|
119927
120011
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119928
120012
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119929
120013
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119930
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119931
|
-
/* useFileVersionAsSignature */ true);
|
|
120014
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119932
120015
|
// If not dts emit, nothing more to do
|
|
119933
120016
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119934
120017
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -120125,13 +120208,18 @@ var ts;
|
|
|
120125
120208
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
120126
120209
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
120127
120210
|
return value.version === actualSignature ?
|
|
120128
|
-
value.affectsGlobalScope ?
|
|
120129
|
-
|
|
120211
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120212
|
+
// If file version is same as signature, dont serialize signature
|
|
120213
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120214
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
120130
120215
|
value.version :
|
|
120131
|
-
actualSignature !== undefined ?
|
|
120216
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
120132
120217
|
signature === undefined ?
|
|
120218
|
+
// If we havent computed signature, use fileInfo as is
|
|
120133
120219
|
value :
|
|
120220
|
+
// Serialize fileInfo with new updated signature
|
|
120134
120221
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120222
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
120135
120223
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
120136
120224
|
});
|
|
120137
120225
|
var referencedMap;
|
|
@@ -120376,7 +120464,7 @@ var ts;
|
|
|
120376
120464
|
* in that order would be used to write the files
|
|
120377
120465
|
*/
|
|
120378
120466
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120379
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120467
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120380
120468
|
var emitKind = 1 /* Full */;
|
|
120381
120469
|
var isPendingEmitFile = false;
|
|
120382
120470
|
if (!affected) {
|
|
@@ -120421,54 +120509,48 @@ var ts;
|
|
|
120421
120509
|
* in that order would be used to write the files
|
|
120422
120510
|
*/
|
|
120423
120511
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120424
|
-
var
|
|
120425
|
-
var savedAffectedFilesPendingEmit;
|
|
120426
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120427
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120428
|
-
// 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
|
|
120429
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120430
|
-
// 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)
|
|
120431
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120432
|
-
!targetSourceFile &&
|
|
120433
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120434
|
-
!state.compilerOptions.noEmit &&
|
|
120435
|
-
state.compilerOptions.noEmitOnError) {
|
|
120436
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120437
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120438
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120439
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120440
|
-
}
|
|
120512
|
+
var _a;
|
|
120441
120513
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120442
120514
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120443
120515
|
}
|
|
120444
120516
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120445
120517
|
if (result)
|
|
120446
120518
|
return result;
|
|
120447
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120448
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120449
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120450
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120451
|
-
}
|
|
120452
120519
|
// Emit only affected files if using builder for emit
|
|
120453
|
-
if (!targetSourceFile
|
|
120454
|
-
|
|
120455
|
-
|
|
120456
|
-
|
|
120457
|
-
|
|
120458
|
-
|
|
120459
|
-
|
|
120460
|
-
|
|
120461
|
-
|
|
120462
|
-
|
|
120463
|
-
|
|
120464
|
-
|
|
120520
|
+
if (!targetSourceFile) {
|
|
120521
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120522
|
+
// Emit and report any errors we ran into.
|
|
120523
|
+
var sourceMaps = [];
|
|
120524
|
+
var emitSkipped = false;
|
|
120525
|
+
var diagnostics = void 0;
|
|
120526
|
+
var emittedFiles = [];
|
|
120527
|
+
var affectedEmitResult = void 0;
|
|
120528
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120529
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120530
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120531
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120532
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120533
|
+
}
|
|
120534
|
+
return {
|
|
120535
|
+
emitSkipped: emitSkipped,
|
|
120536
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120537
|
+
emittedFiles: emittedFiles,
|
|
120538
|
+
sourceMaps: sourceMaps
|
|
120539
|
+
};
|
|
120540
|
+
}
|
|
120541
|
+
// In non Emit builder, clear affected files pending emit
|
|
120542
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120543
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120544
|
+
// State can clear affected files pending emit if
|
|
120545
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120546
|
+
// If every file pending emit is pending on only dts emit
|
|
120547
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120548
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120549
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120550
|
+
})) {
|
|
120551
|
+
clearAffectedFilesPendingEmit(state);
|
|
120552
|
+
}
|
|
120465
120553
|
}
|
|
120466
|
-
return {
|
|
120467
|
-
emitSkipped: emitSkipped,
|
|
120468
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120469
|
-
emittedFiles: emittedFiles,
|
|
120470
|
-
sourceMaps: sourceMaps
|
|
120471
|
-
};
|
|
120472
120554
|
}
|
|
120473
120555
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120474
120556
|
}
|
|
@@ -120478,7 +120560,7 @@ var ts;
|
|
|
120478
120560
|
*/
|
|
120479
120561
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120480
120562
|
while (true) {
|
|
120481
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120563
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120482
120564
|
if (!affected) {
|
|
120483
120565
|
// Done
|
|
120484
120566
|
return undefined;
|
|
@@ -123598,9 +123680,6 @@ var ts;
|
|
|
123598
123680
|
function newer(date1, date2) {
|
|
123599
123681
|
return date2 > date1 ? date2 : date1;
|
|
123600
123682
|
}
|
|
123601
|
-
function isDeclarationFile(fileName) {
|
|
123602
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123603
|
-
}
|
|
123604
123683
|
/*@internal*/
|
|
123605
123684
|
function isCircularBuildOrder(buildOrder) {
|
|
123606
123685
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -124163,7 +124242,7 @@ var ts;
|
|
|
124163
124242
|
outputFiles.forEach(function (_a) {
|
|
124164
124243
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
124165
124244
|
var priorChangeTime;
|
|
124166
|
-
if (!anyDtsChanged &&
|
|
124245
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
124167
124246
|
// Check for unchanged .d.ts files
|
|
124168
124247
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
124169
124248
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124504,7 +124583,7 @@ var ts;
|
|
|
124504
124583
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124505
124584
|
// had its file touched but not had its contents changed - this allows us
|
|
124506
124585
|
// to skip a downstream typecheck
|
|
124507
|
-
if (
|
|
124586
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124508
124587
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124509
124588
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124510
124589
|
}
|
|
@@ -124658,7 +124737,7 @@ var ts;
|
|
|
124658
124737
|
reportVerbose = false;
|
|
124659
124738
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124660
124739
|
}
|
|
124661
|
-
if (
|
|
124740
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124662
124741
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124663
124742
|
}
|
|
124664
124743
|
host.setModifiedTime(file, now);
|
|
@@ -131970,17 +132049,13 @@ var ts;
|
|
|
131970
132049
|
}
|
|
131971
132050
|
}
|
|
131972
132051
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
131973
|
-
|
|
131974
|
-
(insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
|
|
132052
|
+
(insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
|
|
131975
132053
|
if (!preferences.useLabelDetailsInCompletionEntries) {
|
|
131976
132054
|
name = name + labelDetails.detail;
|
|
131977
132055
|
labelDetails = undefined;
|
|
131978
132056
|
}
|
|
131979
132057
|
source = CompletionSource.ObjectLiteralMethodSnippet;
|
|
131980
132058
|
sortText = Completions.SortText.SortBelow(sortText);
|
|
131981
|
-
if (importAdder.hasFixes()) {
|
|
131982
|
-
hasAction = true;
|
|
131983
|
-
}
|
|
131984
132059
|
}
|
|
131985
132060
|
if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
131986
132061
|
var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
|
|
@@ -132203,8 +132278,7 @@ var ts;
|
|
|
132203
132278
|
var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
|
|
132204
132279
|
var insertText = name;
|
|
132205
132280
|
var sourceFile = enclosingDeclaration.getSourceFile();
|
|
132206
|
-
var
|
|
132207
|
-
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
|
|
132281
|
+
var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
|
|
132208
132282
|
if (!method) {
|
|
132209
132283
|
return undefined;
|
|
132210
132284
|
}
|
|
@@ -132233,16 +132307,15 @@ var ts;
|
|
|
132233
132307
|
/*modifiers*/ undefined,
|
|
132234
132308
|
/*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
|
|
132235
132309
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
|
|
132236
|
-
return { isSnippet: isSnippet, insertText: insertText,
|
|
132310
|
+
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
132237
132311
|
}
|
|
132238
132312
|
;
|
|
132239
|
-
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences
|
|
132313
|
+
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
132240
132314
|
var declarations = symbol.getDeclarations();
|
|
132241
132315
|
if (!(declarations && declarations.length)) {
|
|
132242
132316
|
return undefined;
|
|
132243
132317
|
}
|
|
132244
132318
|
var checker = program.getTypeChecker();
|
|
132245
|
-
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
132246
132319
|
var declaration = declarations[0];
|
|
132247
132320
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
132248
132321
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
@@ -132275,11 +132348,6 @@ var ts;
|
|
|
132275
132348
|
if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
|
|
132276
132349
|
return undefined;
|
|
132277
132350
|
}
|
|
132278
|
-
var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
132279
|
-
if (importableReference) {
|
|
132280
|
-
typeNode = importableReference.typeNode;
|
|
132281
|
-
ts.codefix.importSymbols(importAdder, importableReference.symbols);
|
|
132282
|
-
}
|
|
132283
132351
|
var body = void 0;
|
|
132284
132352
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
132285
132353
|
var emptyStmt = ts.factory.createEmptyStatement();
|
|
@@ -132289,11 +132357,19 @@ var ts;
|
|
|
132289
132357
|
else {
|
|
132290
132358
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
132291
132359
|
}
|
|
132360
|
+
var parameters = typeNode.parameters.map(function (typedParam) {
|
|
132361
|
+
return ts.factory.createParameterDeclaration(
|
|
132362
|
+
/*decorators*/ undefined,
|
|
132363
|
+
/*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken,
|
|
132364
|
+
/*type*/ undefined, typedParam.initializer);
|
|
132365
|
+
});
|
|
132292
132366
|
return ts.factory.createMethodDeclaration(
|
|
132293
132367
|
/*decorators*/ undefined,
|
|
132294
132368
|
/*modifiers*/ undefined,
|
|
132295
132369
|
/*asteriskToken*/ undefined, name,
|
|
132296
|
-
/*questionToken*/ undefined,
|
|
132370
|
+
/*questionToken*/ undefined,
|
|
132371
|
+
/*typeParameters*/ undefined, parameters,
|
|
132372
|
+
/*type*/ undefined, body);
|
|
132297
132373
|
}
|
|
132298
132374
|
default:
|
|
132299
132375
|
return undefined;
|
|
@@ -132656,20 +132732,6 @@ var ts;
|
|
|
132656
132732
|
};
|
|
132657
132733
|
}
|
|
132658
132734
|
}
|
|
132659
|
-
if (source === CompletionSource.ObjectLiteralMethodSnippet) {
|
|
132660
|
-
var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
|
|
132661
|
-
var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
|
|
132662
|
-
if (importAdder.hasFixes()) {
|
|
132663
|
-
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
132664
|
-
return {
|
|
132665
|
-
sourceDisplay: undefined,
|
|
132666
|
-
codeActions: [{
|
|
132667
|
-
changes: changes,
|
|
132668
|
-
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
132669
|
-
}],
|
|
132670
|
-
};
|
|
132671
|
-
}
|
|
132672
|
-
}
|
|
132673
132735
|
if (originIsTypeOnlyAlias(origin)) {
|
|
132674
132736
|
var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
|
|
132675
132737
|
ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
|
|
@@ -135490,7 +135552,7 @@ var ts;
|
|
|
135490
135552
|
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
135491
135553
|
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
135492
135554
|
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
135493
|
-
var otherBucketKey = !ts.
|
|
135555
|
+
var otherBucketKey = !ts.isDeclarationFileName(path) &&
|
|
135494
135556
|
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
|
|
135495
135557
|
if (otherBucketKey) {
|
|
135496
135558
|
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
|
|
@@ -137430,6 +137492,30 @@ var ts;
|
|
|
137430
137492
|
}
|
|
137431
137493
|
}
|
|
137432
137494
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
137495
|
+
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
137496
|
+
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
137497
|
+
return candidates.reduce(function (topMost, decl) {
|
|
137498
|
+
var depth = getDepth(decl);
|
|
137499
|
+
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
137500
|
+
topMost.declarationNames.push(decl);
|
|
137501
|
+
topMost.depth = depth;
|
|
137502
|
+
}
|
|
137503
|
+
else if (depth < topMost.depth) {
|
|
137504
|
+
topMost.declarationNames = [decl];
|
|
137505
|
+
topMost.depth = depth;
|
|
137506
|
+
}
|
|
137507
|
+
return topMost;
|
|
137508
|
+
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
137509
|
+
function getDepth(declaration) {
|
|
137510
|
+
var depth = 0;
|
|
137511
|
+
while (declaration) {
|
|
137512
|
+
declaration = ts.getContainerNode(declaration);
|
|
137513
|
+
depth++;
|
|
137514
|
+
}
|
|
137515
|
+
return depth;
|
|
137516
|
+
}
|
|
137517
|
+
}
|
|
137518
|
+
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
137433
137519
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
137434
137520
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
137435
137521
|
return false;
|
|
@@ -139066,7 +139152,9 @@ var ts;
|
|
|
139066
139152
|
(function (ts) {
|
|
139067
139153
|
var GoToDefinition;
|
|
139068
139154
|
(function (GoToDefinition) {
|
|
139069
|
-
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
139155
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139156
|
+
var _a;
|
|
139157
|
+
var _b;
|
|
139070
139158
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
139071
139159
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
139072
139160
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -139089,33 +139177,63 @@ var ts;
|
|
|
139089
139177
|
}
|
|
139090
139178
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139091
139179
|
var classDecl = node.parent.parent;
|
|
139092
|
-
var
|
|
139180
|
+
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139093
139181
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139094
139182
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139095
139183
|
var sourceFile_1 = node.getSourceFile();
|
|
139096
139184
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
139097
139185
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
139098
139186
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
139099
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
139187
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139100
139188
|
});
|
|
139101
139189
|
}
|
|
139102
|
-
var
|
|
139190
|
+
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139191
|
+
var fallbackNode = node;
|
|
139192
|
+
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139193
|
+
// We couldn't resolve the specific import, try on the module specifier.
|
|
139194
|
+
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); });
|
|
139195
|
+
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139196
|
+
if (moduleSpecifier) {
|
|
139197
|
+
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139198
|
+
fallbackNode = moduleSpecifier;
|
|
139199
|
+
}
|
|
139200
|
+
}
|
|
139201
|
+
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
139202
|
+
// We couldn't resolve the module specifier as an external module, but it could
|
|
139203
|
+
// be that module resolution succeeded but the target was not a module.
|
|
139204
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
139205
|
+
if (ref) {
|
|
139206
|
+
return [{
|
|
139207
|
+
name: fallbackNode.text,
|
|
139208
|
+
fileName: ref.resolvedFileName,
|
|
139209
|
+
containerName: undefined,
|
|
139210
|
+
containerKind: undefined,
|
|
139211
|
+
kind: "script" /* scriptElement */,
|
|
139212
|
+
textSpan: ts.createTextSpan(0, 0),
|
|
139213
|
+
failedAliasResolution: failedAliasResolution,
|
|
139214
|
+
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
139215
|
+
unverified: fallbackNode !== node,
|
|
139216
|
+
}];
|
|
139217
|
+
}
|
|
139218
|
+
}
|
|
139103
139219
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
139104
139220
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
139105
139221
|
if (!symbol) {
|
|
139106
139222
|
return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
|
139107
139223
|
}
|
|
139224
|
+
if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
|
|
139225
|
+
return undefined;
|
|
139108
139226
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
139109
139227
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
139110
139228
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
139111
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
139229
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
139112
139230
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
139113
139231
|
// If this is the original constructor definition, parent is the class.
|
|
139114
139232
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
139115
139233
|
return [sigInfo];
|
|
139116
139234
|
}
|
|
139117
139235
|
else {
|
|
139118
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
139236
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
|
|
139119
139237
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
139120
139238
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
139121
139239
|
}
|
|
@@ -139127,7 +139245,7 @@ var ts;
|
|
|
139127
139245
|
// assignment. This case and others are handled by the following code.
|
|
139128
139246
|
if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
|
|
139129
139247
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
139130
|
-
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;
|
|
139248
|
+
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;
|
|
139131
139249
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
139132
139250
|
}
|
|
139133
139251
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -139150,7 +139268,7 @@ var ts;
|
|
|
139150
139268
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
139151
139269
|
});
|
|
139152
139270
|
}
|
|
139153
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
139271
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
|
|
139154
139272
|
}
|
|
139155
139273
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
139156
139274
|
/**
|
|
@@ -139248,24 +139366,24 @@ var ts;
|
|
|
139248
139366
|
return undefined;
|
|
139249
139367
|
}
|
|
139250
139368
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139251
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
139369
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139252
139370
|
}
|
|
139253
|
-
var
|
|
139371
|
+
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139254
139372
|
if (!symbol)
|
|
139255
139373
|
return undefined;
|
|
139256
139374
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
139257
139375
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
139258
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
139376
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
139259
139377
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
139260
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
139378
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
139261
139379
|
return typeDefinitions.length ? typeDefinitions
|
|
139262
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
139380
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node, failedAliasResolution)
|
|
139263
139381
|
: undefined;
|
|
139264
139382
|
}
|
|
139265
139383
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
139266
|
-
function definitionFromType(type, checker, node) {
|
|
139384
|
+
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
139267
139385
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
139268
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
139386
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
|
|
139269
139387
|
});
|
|
139270
139388
|
}
|
|
139271
139389
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -139307,13 +139425,17 @@ var ts;
|
|
|
139307
139425
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139308
139426
|
// import {A, B} from "mod";
|
|
139309
139427
|
// to jump to the implementation directly.
|
|
139428
|
+
var failedAliasResolution = false;
|
|
139310
139429
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139311
139430
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139312
139431
|
if (aliased.declarations) {
|
|
139313
|
-
return aliased;
|
|
139432
|
+
return { symbol: aliased };
|
|
139433
|
+
}
|
|
139434
|
+
else {
|
|
139435
|
+
failedAliasResolution = true;
|
|
139314
139436
|
}
|
|
139315
139437
|
}
|
|
139316
|
-
return symbol;
|
|
139438
|
+
return { symbol: symbol, failedAliasResolution: failedAliasResolution };
|
|
139317
139439
|
}
|
|
139318
139440
|
// Go to the original declaration for cases:
|
|
139319
139441
|
//
|
|
@@ -139327,26 +139449,45 @@ var ts;
|
|
|
139327
139449
|
if (node.parent === declaration) {
|
|
139328
139450
|
return true;
|
|
139329
139451
|
}
|
|
139330
|
-
|
|
139331
|
-
|
|
139332
|
-
case 265 /* ImportEqualsDeclaration */:
|
|
139333
|
-
return true;
|
|
139334
|
-
case 270 /* ImportSpecifier */:
|
|
139335
|
-
return declaration.parent.kind === 269 /* NamedImports */;
|
|
139336
|
-
case 203 /* BindingElement */:
|
|
139337
|
-
case 254 /* VariableDeclaration */:
|
|
139338
|
-
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
139339
|
-
default:
|
|
139340
|
-
return false;
|
|
139452
|
+
if (declaration.kind === 268 /* NamespaceImport */) {
|
|
139453
|
+
return false;
|
|
139341
139454
|
}
|
|
139455
|
+
return true;
|
|
139342
139456
|
}
|
|
139343
|
-
|
|
139344
|
-
|
|
139345
|
-
|
|
139346
|
-
|
|
139347
|
-
|
|
139348
|
-
|
|
139349
|
-
|
|
139457
|
+
/**
|
|
139458
|
+
* ```ts
|
|
139459
|
+
* function f() {}
|
|
139460
|
+
* f.foo = 0;
|
|
139461
|
+
* ```
|
|
139462
|
+
*
|
|
139463
|
+
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
139464
|
+
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
139465
|
+
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
139466
|
+
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
139467
|
+
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
139468
|
+
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
139469
|
+
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
139470
|
+
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
139471
|
+
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
139472
|
+
* up with a more precise definition of what counts as a definition.
|
|
139473
|
+
*/
|
|
139474
|
+
function isExpandoDeclaration(node) {
|
|
139475
|
+
if (!ts.isAssignmentDeclaration(node))
|
|
139476
|
+
return false;
|
|
139477
|
+
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
139478
|
+
if (ts.isAssignmentExpression(p))
|
|
139479
|
+
return true;
|
|
139480
|
+
if (!ts.isAssignmentDeclaration(p))
|
|
139481
|
+
return "quit";
|
|
139482
|
+
return false;
|
|
139483
|
+
});
|
|
139484
|
+
return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
|
|
139485
|
+
}
|
|
139486
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
|
|
139487
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; });
|
|
139488
|
+
var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); });
|
|
139489
|
+
var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
|
|
139490
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); });
|
|
139350
139491
|
function getConstructSignatureDefinition() {
|
|
139351
139492
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
139352
139493
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -139370,26 +139511,27 @@ var ts;
|
|
|
139370
139511
|
return declarations.length
|
|
139371
139512
|
? declarationsWithBody.length !== 0
|
|
139372
139513
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
139373
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
139514
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
|
|
139374
139515
|
: undefined;
|
|
139375
139516
|
}
|
|
139376
139517
|
}
|
|
139377
139518
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
139378
|
-
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
139519
|
+
function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
|
|
139379
139520
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
139380
139521
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
139381
139522
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
139382
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
139523
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
|
|
139383
139524
|
}
|
|
139525
|
+
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
139384
139526
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
139385
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
139527
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
|
|
139386
139528
|
var sourceFile = declaration.getSourceFile();
|
|
139387
139529
|
if (!textSpan) {
|
|
139388
139530
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
139389
139531
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
139390
139532
|
}
|
|
139391
139533
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
139392
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
139534
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216 /* Ambient */), unverified: unverified, failedAliasResolution: failedAliasResolution });
|
|
139393
139535
|
}
|
|
139394
139536
|
function isDefinitionVisible(checker, declaration) {
|
|
139395
139537
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -139422,8 +139564,8 @@ var ts;
|
|
|
139422
139564
|
return false;
|
|
139423
139565
|
}
|
|
139424
139566
|
}
|
|
139425
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
139426
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
139567
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
|
|
139568
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
|
|
139427
139569
|
}
|
|
139428
139570
|
function findReferenceInPosition(refs, pos) {
|
|
139429
139571
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -152538,9 +152680,10 @@ var ts;
|
|
|
152538
152680
|
// 2. add "member3" to the second import statement's import list
|
|
152539
152681
|
// and it is up to the user to decide which one fits best.
|
|
152540
152682
|
return ts.firstDefined(existingImports, function (_a) {
|
|
152683
|
+
var _b;
|
|
152541
152684
|
var declaration = _a.declaration;
|
|
152542
152685
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
152543
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152686
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152544
152687
|
if (namespacePrefix && moduleSpecifier) {
|
|
152545
152688
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
152546
152689
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -152716,8 +152859,9 @@ var ts;
|
|
|
152716
152859
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
152717
152860
|
}
|
|
152718
152861
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152862
|
+
var _b;
|
|
152719
152863
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
152720
|
-
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
152864
|
+
var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
|
|
152721
152865
|
if (moduleSpecifier) {
|
|
152722
152866
|
var addAsTypeOnly = useRequire
|
|
152723
152867
|
? 4 /* NotAllowed */
|
|
@@ -157075,7 +157219,6 @@ var ts;
|
|
|
157075
157219
|
var checker = program.getTypeChecker();
|
|
157076
157220
|
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157077
157221
|
var flags = 1 /* NoTruncation */
|
|
157078
|
-
| 1073741824 /* NoUndefinedOptionalParameterType */
|
|
157079
157222
|
| 256 /* SuppressAnyReturnType */
|
|
157080
157223
|
| 524288 /* AllowEmptyTuple */
|
|
157081
157224
|
| (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
@@ -159454,6 +159597,7 @@ var ts;
|
|
|
159454
159597
|
Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes");
|
|
159455
159598
|
Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS");
|
|
159456
159599
|
Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block");
|
|
159600
|
+
Messages.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method");
|
|
159457
159601
|
})(Messages = extractSymbol.Messages || (extractSymbol.Messages = {}));
|
|
159458
159602
|
var RangeFacts;
|
|
159459
159603
|
(function (RangeFacts) {
|
|
@@ -159462,10 +159606,11 @@ var ts;
|
|
|
159462
159606
|
RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator";
|
|
159463
159607
|
RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction";
|
|
159464
159608
|
RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis";
|
|
159609
|
+
RangeFacts[RangeFacts["UsesThisInFunction"] = 16] = "UsesThisInFunction";
|
|
159465
159610
|
/**
|
|
159466
159611
|
* The range is in a function which needs the 'static' modifier in a class
|
|
159467
159612
|
*/
|
|
159468
|
-
RangeFacts[RangeFacts["InStaticRegion"] =
|
|
159613
|
+
RangeFacts[RangeFacts["InStaticRegion"] = 32] = "InStaticRegion";
|
|
159469
159614
|
})(RangeFacts || (RangeFacts = {}));
|
|
159470
159615
|
/**
|
|
159471
159616
|
* getRangeToExtract takes a span inside a text file and returns either an expression or an array
|
|
@@ -159496,6 +159641,7 @@ var ts;
|
|
|
159496
159641
|
// We'll modify these flags as we walk the tree to collect data
|
|
159497
159642
|
// about what things need to be done as part of the extraction.
|
|
159498
159643
|
var rangeFacts = RangeFacts.None;
|
|
159644
|
+
var thisNode;
|
|
159499
159645
|
if (!start || !end) {
|
|
159500
159646
|
// cannot find either start or end node
|
|
159501
159647
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
@@ -159534,7 +159680,7 @@ var ts;
|
|
|
159534
159680
|
// the expression.
|
|
159535
159681
|
return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
|
|
159536
159682
|
}
|
|
159537
|
-
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } };
|
|
159683
|
+
return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
|
|
159538
159684
|
}
|
|
159539
159685
|
if (ts.isReturnStatement(start) && !start.expression) {
|
|
159540
159686
|
// Makes no sense to extract an expression-less return statement.
|
|
@@ -159546,7 +159692,7 @@ var ts;
|
|
|
159546
159692
|
if (errors) {
|
|
159547
159693
|
return { errors: errors };
|
|
159548
159694
|
}
|
|
159549
|
-
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } }; // TODO: GH#18217
|
|
159695
|
+
return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
|
|
159550
159696
|
/**
|
|
159551
159697
|
* Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
|
|
159552
159698
|
* @param node The unrefined extraction node.
|
|
@@ -159638,6 +159784,14 @@ var ts;
|
|
|
159638
159784
|
var permittedJumps = 4 /* Return */;
|
|
159639
159785
|
var seenLabels;
|
|
159640
159786
|
visit(nodeToCheck);
|
|
159787
|
+
if (rangeFacts & RangeFacts.UsesThis) {
|
|
159788
|
+
var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false);
|
|
159789
|
+
if (container.kind === 256 /* FunctionDeclaration */ ||
|
|
159790
|
+
(container.kind === 169 /* MethodDeclaration */ && container.parent.kind === 205 /* ObjectLiteralExpression */) ||
|
|
159791
|
+
container.kind === 213 /* FunctionExpression */) {
|
|
159792
|
+
rangeFacts |= RangeFacts.UsesThisInFunction;
|
|
159793
|
+
}
|
|
159794
|
+
}
|
|
159641
159795
|
return errors;
|
|
159642
159796
|
function visit(node) {
|
|
159643
159797
|
if (errors) {
|
|
@@ -159676,6 +159830,7 @@ var ts;
|
|
|
159676
159830
|
}
|
|
159677
159831
|
else {
|
|
159678
159832
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159833
|
+
thisNode = node;
|
|
159679
159834
|
}
|
|
159680
159835
|
break;
|
|
159681
159836
|
case 214 /* ArrowFunction */:
|
|
@@ -159683,6 +159838,7 @@ var ts;
|
|
|
159683
159838
|
ts.forEachChild(node, function check(n) {
|
|
159684
159839
|
if (ts.isThis(n)) {
|
|
159685
159840
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159841
|
+
thisNode = node;
|
|
159686
159842
|
}
|
|
159687
159843
|
else if (ts.isClassLike(n) || (ts.isFunctionLike(n) && !ts.isArrowFunction(n))) {
|
|
159688
159844
|
return false;
|
|
@@ -159739,6 +159895,7 @@ var ts;
|
|
|
159739
159895
|
case 192 /* ThisType */:
|
|
159740
159896
|
case 108 /* ThisKeyword */:
|
|
159741
159897
|
rangeFacts |= RangeFacts.UsesThis;
|
|
159898
|
+
thisNode = node;
|
|
159742
159899
|
break;
|
|
159743
159900
|
case 250 /* LabeledStatement */: {
|
|
159744
159901
|
var label = node.label;
|
|
@@ -159826,7 +159983,7 @@ var ts;
|
|
|
159826
159983
|
*/
|
|
159827
159984
|
function collectEnclosingScopes(range) {
|
|
159828
159985
|
var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range;
|
|
159829
|
-
if (range.facts & RangeFacts.UsesThis) {
|
|
159986
|
+
if (range.facts & RangeFacts.UsesThis && !(range.facts & RangeFacts.UsesThisInFunction)) {
|
|
159830
159987
|
// 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
|
|
159831
159988
|
var containingClass = ts.getContainingClass(current);
|
|
159832
159989
|
if (containingClass) {
|
|
@@ -160032,6 +160189,7 @@ var ts;
|
|
|
160032
160189
|
var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty;
|
|
160033
160190
|
ts.suppressLeadingAndTrailingTrivia(body);
|
|
160034
160191
|
var newFunction;
|
|
160192
|
+
var callThis = !!(range.facts & RangeFacts.UsesThisInFunction);
|
|
160035
160193
|
if (ts.isClassLike(scope)) {
|
|
160036
160194
|
// always create private method in TypeScript files
|
|
160037
160195
|
var modifiers = isJS ? [] : [ts.factory.createModifier(121 /* PrivateKeyword */)];
|
|
@@ -160046,6 +160204,15 @@ var ts;
|
|
|
160046
160204
|
/*questionToken*/ undefined, typeParameters, parameters, returnType, body);
|
|
160047
160205
|
}
|
|
160048
160206
|
else {
|
|
160207
|
+
if (callThis) {
|
|
160208
|
+
parameters.unshift(ts.factory.createParameterDeclaration(
|
|
160209
|
+
/*decorators*/ undefined,
|
|
160210
|
+
/*modifiers*/ undefined,
|
|
160211
|
+
/*dotDotDotToken*/ undefined,
|
|
160212
|
+
/*name*/ "this",
|
|
160213
|
+
/*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NoTruncation */),
|
|
160214
|
+
/*initializer*/ undefined));
|
|
160215
|
+
}
|
|
160049
160216
|
newFunction = ts.factory.createFunctionDeclaration(
|
|
160050
160217
|
/*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);
|
|
160051
160218
|
}
|
|
@@ -160062,7 +160229,10 @@ var ts;
|
|
|
160062
160229
|
var newNodes = [];
|
|
160063
160230
|
// replace range with function call
|
|
160064
160231
|
var called = getCalledExpression(scope, range, functionNameText);
|
|
160065
|
-
|
|
160232
|
+
if (callThis) {
|
|
160233
|
+
callArguments.unshift(ts.factory.createIdentifier("this"));
|
|
160234
|
+
}
|
|
160235
|
+
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
|
|
160066
160236
|
callArguments);
|
|
160067
160237
|
if (range.facts & RangeFacts.IsGenerator) {
|
|
160068
160238
|
call = ts.factory.createYieldExpression(ts.factory.createToken(41 /* AsteriskToken */), call);
|
|
@@ -160673,6 +160843,9 @@ var ts;
|
|
|
160673
160843
|
var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
|
|
160674
160844
|
constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
|
|
160675
160845
|
}
|
|
160846
|
+
if (targetRange.facts & RangeFacts.UsesThisInFunction && ts.isClassLike(scopes[i])) {
|
|
160847
|
+
functionErrorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
|
|
160848
|
+
}
|
|
160676
160849
|
var hasWrite = false;
|
|
160677
160850
|
var readonlyClassPropertyWrite;
|
|
160678
160851
|
usagesPerScope[i].usages.forEach(function (value) {
|
|
@@ -164626,9 +164799,9 @@ var ts;
|
|
|
164626
164799
|
}
|
|
164627
164800
|
}
|
|
164628
164801
|
/// Goto definition
|
|
164629
|
-
function getDefinitionAtPosition(fileName, position) {
|
|
164802
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164630
164803
|
synchronizeHostData();
|
|
164631
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
164804
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164632
164805
|
}
|
|
164633
164806
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164634
164807
|
synchronizeHostData();
|
|
@@ -167169,6 +167342,11 @@ var ts;
|
|
|
167169
167342
|
return "/dev/null/autoImportProviderProject" + counter + "*";
|
|
167170
167343
|
}
|
|
167171
167344
|
server.makeAutoImportProviderProjectName = makeAutoImportProviderProjectName;
|
|
167345
|
+
/*@internal*/
|
|
167346
|
+
function makeAuxiliaryProjectName(counter) {
|
|
167347
|
+
return "/dev/null/auxiliaryProject" + counter + "*";
|
|
167348
|
+
}
|
|
167349
|
+
server.makeAuxiliaryProjectName = makeAuxiliaryProjectName;
|
|
167172
167350
|
function createSortedArray() {
|
|
167173
167351
|
return []; // TODO: GH#19873
|
|
167174
167352
|
}
|
|
@@ -167382,6 +167560,7 @@ var ts;
|
|
|
167382
167560
|
CommandTypes["SignatureHelp"] = "signatureHelp";
|
|
167383
167561
|
/* @internal */
|
|
167384
167562
|
CommandTypes["SignatureHelpFull"] = "signatureHelp-full";
|
|
167563
|
+
CommandTypes["FindSourceDefinition"] = "findSourceDefinition";
|
|
167385
167564
|
CommandTypes["Status"] = "status";
|
|
167386
167565
|
CommandTypes["TypeDefinition"] = "typeDefinition";
|
|
167387
167566
|
CommandTypes["ProjectInfo"] = "projectInfo";
|
|
@@ -167961,7 +168140,7 @@ var ts;
|
|
|
167961
168140
|
case 0:
|
|
167962
168141
|
return server.Errors.ThrowNoProject();
|
|
167963
168142
|
case 1:
|
|
167964
|
-
return
|
|
168143
|
+
return ensurePrimaryProjectKind(this.containingProjects[0]);
|
|
167965
168144
|
default:
|
|
167966
168145
|
// If this file belongs to multiple projects, below is the order in which default project is used
|
|
167967
168146
|
// - for open script info, its default configured project during opening is default if info is part of it
|
|
@@ -167999,7 +168178,7 @@ var ts;
|
|
|
167999
168178
|
firstInferredProject = project;
|
|
168000
168179
|
}
|
|
168001
168180
|
}
|
|
168002
|
-
return
|
|
168181
|
+
return ensurePrimaryProjectKind(defaultConfiguredProject ||
|
|
168003
168182
|
firstNonSourceOfProjectReferenceRedirect ||
|
|
168004
168183
|
firstConfiguredProject ||
|
|
168005
168184
|
firstExternalProject ||
|
|
@@ -168075,8 +168254,8 @@ var ts;
|
|
|
168075
168254
|
return !ts.forEach(this.containingProjects, function (p) { return !p.isOrphan(); });
|
|
168076
168255
|
};
|
|
168077
168256
|
/*@internal*/
|
|
168078
|
-
ScriptInfo.prototype.
|
|
168079
|
-
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider; });
|
|
168257
|
+
ScriptInfo.prototype.isContainedByBackgroundProject = function () {
|
|
168258
|
+
return ts.some(this.containingProjects, function (p) { return p.projectKind === server.ProjectKind.AutoImportProvider || p.projectKind === server.ProjectKind.Auxiliary; });
|
|
168080
168259
|
};
|
|
168081
168260
|
/**
|
|
168082
168261
|
* @param line 1 based index
|
|
@@ -168110,8 +168289,13 @@ var ts;
|
|
|
168110
168289
|
return ScriptInfo;
|
|
168111
168290
|
}());
|
|
168112
168291
|
server.ScriptInfo = ScriptInfo;
|
|
168113
|
-
|
|
168114
|
-
|
|
168292
|
+
/**
|
|
168293
|
+
* Throws an error if `project` is an AutoImportProvider or AuxiliaryProject,
|
|
168294
|
+
* which are used in the background by other Projects and should never be
|
|
168295
|
+
* reported as the default project for a ScriptInfo.
|
|
168296
|
+
*/
|
|
168297
|
+
function ensurePrimaryProjectKind(project) {
|
|
168298
|
+
if (!project || project.projectKind === server.ProjectKind.AutoImportProvider || project.projectKind === server.ProjectKind.Auxiliary) {
|
|
168115
168299
|
return server.Errors.ThrowNoProject();
|
|
168116
168300
|
}
|
|
168117
168301
|
return project;
|
|
@@ -168251,6 +168435,7 @@ var ts;
|
|
|
168251
168435
|
ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
|
|
168252
168436
|
ProjectKind[ProjectKind["External"] = 2] = "External";
|
|
168253
168437
|
ProjectKind[ProjectKind["AutoImportProvider"] = 3] = "AutoImportProvider";
|
|
168438
|
+
ProjectKind[ProjectKind["Auxiliary"] = 4] = "Auxiliary";
|
|
168254
168439
|
})(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));
|
|
168255
168440
|
/* @internal */
|
|
168256
168441
|
function countEachFileTypes(infos, includeSizes) {
|
|
@@ -168276,7 +168461,7 @@ var ts;
|
|
|
168276
168461
|
result.jsxSize += fileSize;
|
|
168277
168462
|
break;
|
|
168278
168463
|
case 3 /* TS */:
|
|
168279
|
-
if (ts.
|
|
168464
|
+
if (ts.isDeclarationFileName(info.fileName)) {
|
|
168280
168465
|
result.dts += 1;
|
|
168281
168466
|
result.dtsSize += fileSize;
|
|
168282
168467
|
}
|
|
@@ -168314,7 +168499,7 @@ var ts;
|
|
|
168314
168499
|
server.allFilesAreJsOrDts = allFilesAreJsOrDts;
|
|
168315
168500
|
/* @internal */
|
|
168316
168501
|
function hasNoTypeScriptSource(fileNames) {
|
|
168317
|
-
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.
|
|
168502
|
+
return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.isDeclarationFileName(fileName)) || ts.fileExtensionIs(fileName, ".tsx" /* Tsx */); });
|
|
168318
168503
|
}
|
|
168319
168504
|
server.hasNoTypeScriptSource = hasNoTypeScriptSource;
|
|
168320
168505
|
function isGeneratedFileWatcher(watch) {
|
|
@@ -168718,7 +168903,7 @@ var ts;
|
|
|
168718
168903
|
}
|
|
168719
168904
|
// Update the signature
|
|
168720
168905
|
if (this.builderState && ts.getEmitDeclarations(this.compilerOptions)) {
|
|
168721
|
-
var dtsFiles = outputFiles.filter(function (f) { return ts.
|
|
168906
|
+
var dtsFiles = outputFiles.filter(function (f) { return ts.isDeclarationFileName(f.name); });
|
|
168722
168907
|
if (dtsFiles.length === 1) {
|
|
168723
168908
|
var sourceFile = this.program.getSourceFile(scriptInfo.fileName);
|
|
168724
168909
|
var signature = this.projectService.host.createHash ?
|
|
@@ -168837,6 +169022,10 @@ var ts;
|
|
|
168837
169022
|
this.autoImportProviderHost.close();
|
|
168838
169023
|
}
|
|
168839
169024
|
this.autoImportProviderHost = undefined;
|
|
169025
|
+
if (this.noDtsResolutionProject) {
|
|
169026
|
+
this.noDtsResolutionProject.close();
|
|
169027
|
+
}
|
|
169028
|
+
this.noDtsResolutionProject = undefined;
|
|
168840
169029
|
// signal language service to release source files acquired from document registry
|
|
168841
169030
|
this.languageService.dispose();
|
|
168842
169031
|
this.languageService = undefined;
|
|
@@ -169359,11 +169548,13 @@ var ts;
|
|
|
169359
169548
|
}
|
|
169360
169549
|
};
|
|
169361
169550
|
Project.prototype.setCompilerOptions = function (compilerOptions) {
|
|
169551
|
+
var _a;
|
|
169362
169552
|
if (compilerOptions) {
|
|
169363
169553
|
compilerOptions.allowNonTsExtensions = true;
|
|
169364
169554
|
var oldOptions = this.compilerOptions;
|
|
169365
169555
|
this.compilerOptions = compilerOptions;
|
|
169366
169556
|
this.setInternalCompilerOptionsForEmittingJsFiles();
|
|
169557
|
+
(_a = this.noDtsResolutionProject) === null || _a === void 0 ? void 0 : _a.setCompilerOptions(this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169367
169558
|
if (ts.changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
169368
169559
|
// reset cached unresolved imports if changes in compiler options affected module resolution
|
|
169369
169560
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
@@ -169703,6 +169894,31 @@ var ts;
|
|
|
169703
169894
|
Project.prototype.getIncompleteCompletionsCache = function () {
|
|
169704
169895
|
return this.projectService.getIncompleteCompletionsCache();
|
|
169705
169896
|
};
|
|
169897
|
+
/*@internal*/
|
|
169898
|
+
Project.prototype.getNoDtsResolutionProject = function (rootFileNames) {
|
|
169899
|
+
var _this = this;
|
|
169900
|
+
ts.Debug.assert(this.projectService.serverMode === ts.LanguageServiceMode.Semantic);
|
|
169901
|
+
if (!this.noDtsResolutionProject) {
|
|
169902
|
+
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
|
|
169903
|
+
}
|
|
169904
|
+
ts.enumerateInsertsAndDeletes(rootFileNames.map(server.toNormalizedPath), this.noDtsResolutionProject.getRootFiles(), ts.getStringComparer(!this.useCaseSensitiveFileNames()), function (pathToAdd) {
|
|
169905
|
+
var info = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(pathToAdd, _this.currentDirectory, _this.noDtsResolutionProject.directoryStructureHost);
|
|
169906
|
+
if (info) {
|
|
169907
|
+
_this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
169908
|
+
}
|
|
169909
|
+
}, function (pathToRemove) {
|
|
169910
|
+
// It may be preferable to remove roots only once project grows to a certain size?
|
|
169911
|
+
var info = _this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
169912
|
+
if (info) {
|
|
169913
|
+
_this.noDtsResolutionProject.removeRoot(info);
|
|
169914
|
+
}
|
|
169915
|
+
});
|
|
169916
|
+
return this.noDtsResolutionProject;
|
|
169917
|
+
};
|
|
169918
|
+
/*@internal*/
|
|
169919
|
+
Project.prototype.getCompilerOptionsForNoDtsResolutionProject = function () {
|
|
169920
|
+
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 });
|
|
169921
|
+
};
|
|
169706
169922
|
return Project;
|
|
169707
169923
|
}());
|
|
169708
169924
|
server.Project = Project;
|
|
@@ -169818,6 +170034,26 @@ var ts;
|
|
|
169818
170034
|
return InferredProject;
|
|
169819
170035
|
}(Project));
|
|
169820
170036
|
server.InferredProject = InferredProject;
|
|
170037
|
+
var AuxiliaryProject = /** @class */ (function (_super) {
|
|
170038
|
+
__extends(AuxiliaryProject, _super);
|
|
170039
|
+
function AuxiliaryProject(projectService, documentRegistry, compilerOptions) {
|
|
170040
|
+
return _super.call(this, projectService.newAuxiliaryProjectName(), ProjectKind.Auxiliary, projectService, documentRegistry,
|
|
170041
|
+
/*hasExplicitListOfFiles*/ false,
|
|
170042
|
+
/*lastFileExceededProgramSize*/ undefined, compilerOptions,
|
|
170043
|
+
/*compileOnSaveEnabled*/ false,
|
|
170044
|
+
/*watchOptions*/ undefined, projectService.host,
|
|
170045
|
+
/*currentDirectory*/ undefined) || this;
|
|
170046
|
+
}
|
|
170047
|
+
AuxiliaryProject.prototype.isOrphan = function () {
|
|
170048
|
+
return true;
|
|
170049
|
+
};
|
|
170050
|
+
/*@internal*/
|
|
170051
|
+
AuxiliaryProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170052
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170053
|
+
return;
|
|
170054
|
+
};
|
|
170055
|
+
return AuxiliaryProject;
|
|
170056
|
+
}(Project));
|
|
169821
170057
|
var AutoImportProviderProject = /** @class */ (function (_super) {
|
|
169822
170058
|
__extends(AutoImportProviderProject, _super);
|
|
169823
170059
|
/*@internal*/
|
|
@@ -169969,6 +170205,11 @@ var ts;
|
|
|
169969
170205
|
}
|
|
169970
170206
|
return hasSameSetOfFiles;
|
|
169971
170207
|
};
|
|
170208
|
+
/*@internal*/
|
|
170209
|
+
AutoImportProviderProject.prototype.scheduleInvalidateResolutionsOfFailedLookupLocations = function () {
|
|
170210
|
+
// Invalidation will happen on-demand as part of updateGraph
|
|
170211
|
+
return;
|
|
170212
|
+
};
|
|
169972
170213
|
AutoImportProviderProject.prototype.hasRoots = function () {
|
|
169973
170214
|
var _a;
|
|
169974
170215
|
return !!((_a = this.rootFileNames) === null || _a === void 0 ? void 0 : _a.length);
|
|
@@ -170654,6 +170895,8 @@ var ts;
|
|
|
170654
170895
|
this.newInferredProjectName = createProjectNameFactoryWithCounter(server.makeInferredProjectName);
|
|
170655
170896
|
/*@internal*/
|
|
170656
170897
|
this.newAutoImportProviderProjectName = createProjectNameFactoryWithCounter(server.makeAutoImportProviderProjectName);
|
|
170898
|
+
/*@internal*/
|
|
170899
|
+
this.newAuxiliaryProjectName = createProjectNameFactoryWithCounter(server.makeAuxiliaryProjectName);
|
|
170657
170900
|
/**
|
|
170658
170901
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
170659
170902
|
*/
|
|
@@ -170857,13 +171100,15 @@ var ts;
|
|
|
170857
171100
|
ProjectService.prototype.delayUpdateProjectGraph = function (project) {
|
|
170858
171101
|
var _this = this;
|
|
170859
171102
|
project.markAsDirty();
|
|
170860
|
-
|
|
170861
|
-
|
|
170862
|
-
|
|
170863
|
-
|
|
170864
|
-
|
|
170865
|
-
|
|
170866
|
-
|
|
171103
|
+
if (project.projectKind !== server.ProjectKind.AutoImportProvider && project.projectKind !== server.ProjectKind.Auxiliary) {
|
|
171104
|
+
var projectName_1 = project.getProjectName();
|
|
171105
|
+
this.pendingProjectUpdates.set(projectName_1, project);
|
|
171106
|
+
this.throttledOperations.schedule(projectName_1, /*delay*/ 250, function () {
|
|
171107
|
+
if (_this.pendingProjectUpdates.delete(projectName_1)) {
|
|
171108
|
+
updateProjectIfDirty(project);
|
|
171109
|
+
}
|
|
171110
|
+
});
|
|
171111
|
+
}
|
|
170867
171112
|
};
|
|
170868
171113
|
/*@internal*/
|
|
170869
171114
|
ProjectService.prototype.hasPendingProjectUpdate = function (project) {
|
|
@@ -173144,7 +173389,7 @@ var ts;
|
|
|
173144
173389
|
var toRemoveScriptInfos = new ts.Map(this.filenameToScriptInfo);
|
|
173145
173390
|
this.filenameToScriptInfo.forEach(function (info) {
|
|
173146
173391
|
// If script info is open or orphan, retain it and its dependencies
|
|
173147
|
-
if (!info.isScriptOpen() && info.isOrphan() && !info.
|
|
173392
|
+
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
173148
173393
|
// Otherwise if there is any source info that is alive, this alive too
|
|
173149
173394
|
if (!info.sourceMapFilePath)
|
|
173150
173395
|
return;
|
|
@@ -174440,6 +174685,9 @@ var ts;
|
|
|
174440
174685
|
_a[server.CommandNames.DefinitionAndBoundSpanFull] = function (request) {
|
|
174441
174686
|
return _this.requiredResponse(_this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
174442
174687
|
},
|
|
174688
|
+
_a[server.CommandNames.FindSourceDefinition] = function (request) {
|
|
174689
|
+
return _this.requiredResponse(_this.findSourceDefinition(request.arguments));
|
|
174690
|
+
},
|
|
174443
174691
|
_a[server.CommandNames.EmitOutput] = function (request) {
|
|
174444
174692
|
return _this.requiredResponse(_this.getEmitOutput(request.arguments));
|
|
174445
174693
|
},
|
|
@@ -175181,7 +175429,7 @@ var ts;
|
|
|
175181
175429
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
175182
175430
|
return definitions.map(function (info) {
|
|
175183
175431
|
var newDocumentSpan = getMappedDocumentSpan(info, project);
|
|
175184
|
-
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name }), info.unverified && { unverified: info.unverified });
|
|
175432
|
+
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 });
|
|
175185
175433
|
});
|
|
175186
175434
|
};
|
|
175187
175435
|
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
|
@@ -175208,6 +175456,152 @@ var ts;
|
|
|
175208
175456
|
textSpan: textSpan,
|
|
175209
175457
|
};
|
|
175210
175458
|
};
|
|
175459
|
+
Session.prototype.findSourceDefinition = function (args) {
|
|
175460
|
+
var _a;
|
|
175461
|
+
var _b = this.getFileAndProject(args), file = _b.file, project = _b.project;
|
|
175462
|
+
var position = this.getPositionInFile(args, file);
|
|
175463
|
+
var unmappedDefinitions = project.getLanguageService().getDefinitionAtPosition(file, position);
|
|
175464
|
+
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || server.emptyArray, project).slice();
|
|
175465
|
+
var needsJsResolution = this.projectService.serverMode === ts.LanguageServiceMode.Semantic && (!ts.some(definitions, function (d) { return server.toNormalizedPath(d.fileName) !== file && !d.isAmbient; }) ||
|
|
175466
|
+
ts.some(definitions, function (d) { return !!d.failedAliasResolution; }));
|
|
175467
|
+
if (needsJsResolution) {
|
|
175468
|
+
var definitionSet_1 = ts.createSet(function (d) { return d.textSpan.start; }, ts.documentSpansEqual);
|
|
175469
|
+
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175470
|
+
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175471
|
+
var ls = noDtsProject.getLanguageService();
|
|
175472
|
+
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; });
|
|
175473
|
+
if (ts.some(jsDefinitions)) {
|
|
175474
|
+
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175475
|
+
var jsDefinition = jsDefinitions_1[_i];
|
|
175476
|
+
if (jsDefinition.unverified) {
|
|
175477
|
+
var refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram());
|
|
175478
|
+
if (ts.some(refined)) {
|
|
175479
|
+
for (var _c = 0, refined_1 = refined; _c < refined_1.length; _c++) {
|
|
175480
|
+
var def = refined_1[_c];
|
|
175481
|
+
definitionSet_1.add(def);
|
|
175482
|
+
}
|
|
175483
|
+
continue;
|
|
175484
|
+
}
|
|
175485
|
+
}
|
|
175486
|
+
definitionSet_1.add(jsDefinition);
|
|
175487
|
+
}
|
|
175488
|
+
}
|
|
175489
|
+
else {
|
|
175490
|
+
var ambientCandidates = definitions.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; });
|
|
175491
|
+
for (var _d = 0, _e = ts.some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain(); _d < _e.length; _d++) {
|
|
175492
|
+
var candidate = _e[_d];
|
|
175493
|
+
var fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
175494
|
+
if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
|
|
175495
|
+
continue;
|
|
175496
|
+
}
|
|
175497
|
+
var noDtsProgram = ls.getProgram();
|
|
175498
|
+
var fileToSearch = ts.Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
175499
|
+
for (var _f = 0, _g = searchForDeclaration(candidate.name, fileToSearch, noDtsProgram); _f < _g.length; _f++) {
|
|
175500
|
+
var match = _g[_f];
|
|
175501
|
+
definitionSet_1.add(match);
|
|
175502
|
+
}
|
|
175503
|
+
}
|
|
175504
|
+
}
|
|
175505
|
+
definitions = ts.arrayFrom(definitionSet_1.values());
|
|
175506
|
+
}
|
|
175507
|
+
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
175508
|
+
return this.mapDefinitionInfo(definitions, project);
|
|
175509
|
+
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
175510
|
+
var _a;
|
|
175511
|
+
var nodeModulesPathParts = ts.getNodeModulePathParts(fileName);
|
|
175512
|
+
if (nodeModulesPathParts && fileName.lastIndexOf(ts.nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
175513
|
+
// Second check ensures the fileName only contains one `/node_modules/`. If there's more than one I give up.
|
|
175514
|
+
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
175515
|
+
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
175516
|
+
var compilerOptions = project.getCompilationSettings();
|
|
175517
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175518
|
+
if (!packageJson)
|
|
175519
|
+
return undefined;
|
|
175520
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node12 or nodenext -
|
|
175521
|
+
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175522
|
+
// resolved from the package root under --moduleResolution node
|
|
175523
|
+
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
175524
|
+
// This substring is correct only because we checked for a single `/node_modules/` at the top.
|
|
175525
|
+
var packageNamePathPart = fileName.substring(nodeModulesPathParts.topLevelPackageNameIndex + 1, nodeModulesPathParts.packageRootIndex);
|
|
175526
|
+
var packageName = ts.getPackageNameFromTypesPackageName(ts.unmangleScopedPackageName(packageNamePathPart));
|
|
175527
|
+
var path_1 = project.toPath(fileName);
|
|
175528
|
+
if (entrypoints && ts.some(entrypoints, function (e) { return project.toPath(e) === path_1; })) {
|
|
175529
|
+
// This file was the main entrypoint of a package. Try to resolve that same package name with
|
|
175530
|
+
// the auxiliary project that only resolves to implementation files.
|
|
175531
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile)[0];
|
|
175532
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175533
|
+
}
|
|
175534
|
+
else {
|
|
175535
|
+
// It wasn't the main entrypoint but we are in node_modules. Try a subpath into the package.
|
|
175536
|
+
var pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
175537
|
+
var specifier = packageName + "/" + ts.removeFileExtension(pathToFileInPackage);
|
|
175538
|
+
var implementationResolution = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile)[0];
|
|
175539
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
175540
|
+
}
|
|
175541
|
+
}
|
|
175542
|
+
// We're not in node_modules, and we only get to this function if non-dts module resolution failed.
|
|
175543
|
+
// I'm not sure what else I can do here that isn't already covered by that module resolution.
|
|
175544
|
+
return undefined;
|
|
175545
|
+
}
|
|
175546
|
+
// In 'foo.bar./**/baz', if we got not results on 'baz', see if we can get an ambient definition
|
|
175547
|
+
// for 'bar' or 'foo' (in that order) so we can search for declarations of 'baz' later.
|
|
175548
|
+
function getAmbientCandidatesByClimbingAccessChain() {
|
|
175549
|
+
var ls = project.getLanguageService();
|
|
175550
|
+
var program = ls.getProgram();
|
|
175551
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175552
|
+
if ((ts.isStringLiteralLike(initialNode) || ts.isIdentifier(initialNode)) && ts.isAccessExpression(initialNode.parent)) {
|
|
175553
|
+
return ts.forEachNameInAccessChainWalkingLeft(initialNode, function (nameInChain) {
|
|
175554
|
+
var _a;
|
|
175555
|
+
if (nameInChain === initialNode)
|
|
175556
|
+
return undefined;
|
|
175557
|
+
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 ({
|
|
175558
|
+
fileName: d.fileName,
|
|
175559
|
+
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175560
|
+
}); });
|
|
175561
|
+
if (ts.some(candidates)) {
|
|
175562
|
+
return candidates;
|
|
175563
|
+
}
|
|
175564
|
+
}) || server.emptyArray;
|
|
175565
|
+
}
|
|
175566
|
+
return server.emptyArray;
|
|
175567
|
+
}
|
|
175568
|
+
function tryRefineDefinition(definition, program, noDtsProgram) {
|
|
175569
|
+
var _a;
|
|
175570
|
+
var fileToSearch = noDtsProgram.getSourceFile(definition.fileName);
|
|
175571
|
+
if (!fileToSearch) {
|
|
175572
|
+
return undefined;
|
|
175573
|
+
}
|
|
175574
|
+
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
175575
|
+
var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode);
|
|
175576
|
+
var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* ImportSpecifier */);
|
|
175577
|
+
if (!importSpecifier)
|
|
175578
|
+
return undefined;
|
|
175579
|
+
var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text;
|
|
175580
|
+
return searchForDeclaration(nameToSearch, fileToSearch, noDtsProgram);
|
|
175581
|
+
}
|
|
175582
|
+
function searchForDeclaration(declarationName, fileToSearch, noDtsProgram) {
|
|
175583
|
+
var matches = ts.FindAllReferences.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
|
|
175584
|
+
return ts.mapDefined(matches, function (match) {
|
|
175585
|
+
var symbol = noDtsProgram.getTypeChecker().getSymbolAtLocation(match);
|
|
175586
|
+
var decl = ts.getDeclarationFromName(match);
|
|
175587
|
+
if (symbol && decl) {
|
|
175588
|
+
// I think the last argument to this is supposed to be the start node, but it doesn't seem important.
|
|
175589
|
+
// Callers internal to GoToDefinition already get confused about this.
|
|
175590
|
+
return ts.GoToDefinition.createDefinitionInfo(decl, noDtsProgram.getTypeChecker(), symbol, decl, /*unverified*/ true);
|
|
175591
|
+
}
|
|
175592
|
+
});
|
|
175593
|
+
}
|
|
175594
|
+
function ensureRoot(project, fileName) {
|
|
175595
|
+
var info = project.getScriptInfo(fileName);
|
|
175596
|
+
if (!info)
|
|
175597
|
+
return false;
|
|
175598
|
+
if (!project.containsScriptInfo(info)) {
|
|
175599
|
+
project.addRoot(info);
|
|
175600
|
+
project.updateGraph();
|
|
175601
|
+
}
|
|
175602
|
+
return true;
|
|
175603
|
+
}
|
|
175604
|
+
};
|
|
175211
175605
|
Session.prototype.getEmitOutput = function (args) {
|
|
175212
175606
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
175213
175607
|
if (!project.shouldEmitFile(project.getScriptInfo(file))) {
|
|
@@ -175771,7 +176165,7 @@ var ts;
|
|
|
175771
176165
|
return undefined;
|
|
175772
176166
|
}
|
|
175773
176167
|
var compilationSettings = project.getCompilationSettings();
|
|
175774
|
-
if (!!compilationSettings.noEmit || ts.
|
|
176168
|
+
if (!!compilationSettings.noEmit || ts.isDeclarationFileName(info.fileName) && !dtsChangeCanAffectEmit(compilationSettings)) {
|
|
175775
176169
|
// avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
|
|
175776
176170
|
return undefined;
|
|
175777
176171
|
}
|
|
@@ -176251,7 +176645,7 @@ var ts;
|
|
|
176251
176645
|
else {
|
|
176252
176646
|
var info = this.projectService.getScriptInfo(fileNameInProject); // TODO: GH#18217
|
|
176253
176647
|
if (!info.isScriptOpen()) {
|
|
176254
|
-
if (ts.
|
|
176648
|
+
if (ts.isDeclarationFileName(fileNameInProject)) {
|
|
176255
176649
|
veryLowPriorityFiles.push(fileNameInProject);
|
|
176256
176650
|
}
|
|
176257
176651
|
else {
|