typescript 4.5.0-dev.20211027 → 4.5.0-dev.20211031
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 +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/lib.dom.d.ts +186 -92
- package/lib/lib.dom.iterable.d.ts +1 -7
- package/lib/lib.webworker.d.ts +60 -19
- package/lib/lib.webworker.iterable.d.ts +0 -7
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +7 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +280 -92
- package/lib/tsserver.js +612 -158
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +612 -158
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +608 -158
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +608 -158
- package/lib/typingsInstaller.js +340 -95
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211031";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2551,6 +2551,10 @@ var ts;
|
|
|
2551
2551
|
return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
|
|
2552
2552
|
}
|
|
2553
2553
|
Debug.formatSyntaxKind = formatSyntaxKind;
|
|
2554
|
+
function formatSnippetKind(kind) {
|
|
2555
|
+
return formatEnum(kind, ts.SnippetKind, /*isFlags*/ false);
|
|
2556
|
+
}
|
|
2557
|
+
Debug.formatSnippetKind = formatSnippetKind;
|
|
2554
2558
|
function formatNodeFlags(flags) {
|
|
2555
2559
|
return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
|
|
2556
2560
|
}
|
|
@@ -4467,6 +4471,13 @@ var ts;
|
|
|
4467
4471
|
ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
|
|
4468
4472
|
})(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
|
|
4469
4473
|
/* @internal */
|
|
4474
|
+
var MemberOverrideStatus;
|
|
4475
|
+
(function (MemberOverrideStatus) {
|
|
4476
|
+
MemberOverrideStatus[MemberOverrideStatus["Ok"] = 0] = "Ok";
|
|
4477
|
+
MemberOverrideStatus[MemberOverrideStatus["NeedsOverride"] = 1] = "NeedsOverride";
|
|
4478
|
+
MemberOverrideStatus[MemberOverrideStatus["HasInvalidOverride"] = 2] = "HasInvalidOverride";
|
|
4479
|
+
})(MemberOverrideStatus = ts.MemberOverrideStatus || (ts.MemberOverrideStatus = {}));
|
|
4480
|
+
/* @internal */
|
|
4470
4481
|
var UnionReduction;
|
|
4471
4482
|
(function (UnionReduction) {
|
|
4472
4483
|
UnionReduction[UnionReduction["None"] = 0] = "None";
|
|
@@ -5115,7 +5126,7 @@ var ts;
|
|
|
5115
5126
|
(function (ModuleResolutionKind) {
|
|
5116
5127
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5117
5128
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5118
|
-
// Starting with node12, node's module resolver has significant departures from
|
|
5129
|
+
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5119
5130
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5120
5131
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5121
5132
|
// version-anchored resolution target
|
|
@@ -5448,6 +5459,15 @@ var ts;
|
|
|
5448
5459
|
// Masks
|
|
5449
5460
|
// - Additional bitmasks
|
|
5450
5461
|
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
|
|
5462
|
+
// Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
|
|
5463
|
+
/* @internal */
|
|
5464
|
+
var SnippetKind;
|
|
5465
|
+
(function (SnippetKind) {
|
|
5466
|
+
SnippetKind[SnippetKind["TabStop"] = 0] = "TabStop";
|
|
5467
|
+
SnippetKind[SnippetKind["Placeholder"] = 1] = "Placeholder";
|
|
5468
|
+
SnippetKind[SnippetKind["Choice"] = 2] = "Choice";
|
|
5469
|
+
SnippetKind[SnippetKind["Variable"] = 3] = "Variable";
|
|
5470
|
+
})(SnippetKind = ts.SnippetKind || (ts.SnippetKind = {}));
|
|
5451
5471
|
var EmitFlags;
|
|
5452
5472
|
(function (EmitFlags) {
|
|
5453
5473
|
EmitFlags[EmitFlags["None"] = 0] = "None";
|
|
@@ -8684,6 +8704,8 @@ var ts;
|
|
|
8684
8704
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
|
|
8685
8705
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8686
8706
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8707
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
|
|
8708
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
|
|
8687
8709
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
8688
8710
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
8689
8711
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -8790,6 +8812,7 @@ var ts;
|
|
|
8790
8812
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
|
|
8791
8813
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
8792
8814
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8815
|
+
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
8793
8816
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
8794
8817
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
8795
8818
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -9343,6 +9366,7 @@ var ts;
|
|
|
9343
9366
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9344
9367
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9345
9368
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9369
|
+
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9346
9370
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9347
9371
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9348
9372
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -9446,6 +9470,7 @@ var ts;
|
|
|
9446
9470
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9447
9471
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9448
9472
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9473
|
+
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
9449
9474
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9450
9475
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9451
9476
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -19639,6 +19664,8 @@ var ts;
|
|
|
19639
19664
|
case ts.ModuleKind.ES2020:
|
|
19640
19665
|
case ts.ModuleKind.ES2022:
|
|
19641
19666
|
case ts.ModuleKind.ESNext:
|
|
19667
|
+
case ts.ModuleKind.Node12:
|
|
19668
|
+
case ts.ModuleKind.NodeNext:
|
|
19642
19669
|
return true;
|
|
19643
19670
|
default:
|
|
19644
19671
|
return false;
|
|
@@ -20750,6 +20777,10 @@ var ts;
|
|
|
20750
20777
|
return node.kind === 212 /* FunctionExpression */ || node.kind === 213 /* ArrowFunction */;
|
|
20751
20778
|
}
|
|
20752
20779
|
ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
|
|
20780
|
+
function escapeSnippetText(text) {
|
|
20781
|
+
return text.replace(/\$/gm, "\\$");
|
|
20782
|
+
}
|
|
20783
|
+
ts.escapeSnippetText = escapeSnippetText;
|
|
20753
20784
|
})(ts || (ts = {}));
|
|
20754
20785
|
/* @internal */
|
|
20755
20786
|
var ts;
|
|
@@ -26953,6 +26984,25 @@ var ts;
|
|
|
26953
26984
|
}
|
|
26954
26985
|
}
|
|
26955
26986
|
ts.moveEmitHelpers = moveEmitHelpers;
|
|
26987
|
+
/**
|
|
26988
|
+
* Gets the SnippetElement of a node.
|
|
26989
|
+
*/
|
|
26990
|
+
/* @internal */
|
|
26991
|
+
function getSnippetElement(node) {
|
|
26992
|
+
var _a;
|
|
26993
|
+
return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
|
|
26994
|
+
}
|
|
26995
|
+
ts.getSnippetElement = getSnippetElement;
|
|
26996
|
+
/**
|
|
26997
|
+
* Sets the SnippetElement of a node.
|
|
26998
|
+
*/
|
|
26999
|
+
/* @internal */
|
|
27000
|
+
function setSnippetElement(node, snippet) {
|
|
27001
|
+
var emitNode = getOrCreateEmitNode(node);
|
|
27002
|
+
emitNode.snippetElement = snippet;
|
|
27003
|
+
return node;
|
|
27004
|
+
}
|
|
27005
|
+
ts.setSnippetElement = setSnippetElement;
|
|
26956
27006
|
/* @internal */
|
|
26957
27007
|
function ignoreSourceNewlines(node) {
|
|
26958
27008
|
getOrCreateEmitNode(node).flags |= 134217728 /* IgnoreSourceNewlines */;
|
|
@@ -47078,6 +47128,7 @@ var ts;
|
|
|
47078
47128
|
isDeclarationVisible: isDeclarationVisible,
|
|
47079
47129
|
isPropertyAccessible: isPropertyAccessible,
|
|
47080
47130
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47131
|
+
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47081
47132
|
};
|
|
47082
47133
|
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47083
47134
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -47321,6 +47372,21 @@ var ts;
|
|
|
47321
47372
|
var enumRelation = new ts.Map();
|
|
47322
47373
|
var builtinGlobals = ts.createSymbolTable();
|
|
47323
47374
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
47375
|
+
// Extensions suggested for path imports when module resolution is node12 or higher.
|
|
47376
|
+
// The first element of each tuple is the extension a file has.
|
|
47377
|
+
// The second element of each tuple is the extension that should be used in a path import.
|
|
47378
|
+
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
47379
|
+
var suggestedExtensions = [
|
|
47380
|
+
[".mts", ".mjs"],
|
|
47381
|
+
[".ts", ".js"],
|
|
47382
|
+
[".cts", ".cjs"],
|
|
47383
|
+
[".mjs", ".mjs"],
|
|
47384
|
+
[".js", ".js"],
|
|
47385
|
+
[".cjs", ".cjs"],
|
|
47386
|
+
[".tsx", compilerOptions.jsx === 1 /* Preserve */ ? ".jsx" : ".js"],
|
|
47387
|
+
[".jsx", ".jsx"],
|
|
47388
|
+
[".json", ".json"],
|
|
47389
|
+
];
|
|
47324
47390
|
initializeTypeChecker();
|
|
47325
47391
|
return checker;
|
|
47326
47392
|
function getJsxNamespace(location) {
|
|
@@ -48824,6 +48890,10 @@ var ts;
|
|
|
48824
48890
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
48825
48891
|
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
48826
48892
|
}
|
|
48893
|
+
function isOnlyImportedAsDefault(usage) {
|
|
48894
|
+
var usageMode = getUsageModeForExpression(usage);
|
|
48895
|
+
return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
|
|
48896
|
+
}
|
|
48827
48897
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
48828
48898
|
var usageMode = file && getUsageModeForExpression(usage);
|
|
48829
48899
|
if (file && usageMode !== undefined) {
|
|
@@ -48874,8 +48944,9 @@ var ts;
|
|
|
48874
48944
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
48875
48945
|
}
|
|
48876
48946
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
48947
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
|
|
48877
48948
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
48878
|
-
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
48949
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
48879
48950
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
48880
48951
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48881
48952
|
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
@@ -48889,7 +48960,7 @@ var ts;
|
|
|
48889
48960
|
reportNonDefaultExport(moduleSymbol, node);
|
|
48890
48961
|
}
|
|
48891
48962
|
}
|
|
48892
|
-
else if (hasSyntheticDefault) {
|
|
48963
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
48893
48964
|
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
48894
48965
|
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48895
48966
|
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
@@ -49014,7 +49085,7 @@ var ts;
|
|
|
49014
49085
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
49015
49086
|
if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
|
|
49016
49087
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49017
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49088
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49018
49089
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49019
49090
|
}
|
|
49020
49091
|
}
|
|
@@ -49531,7 +49602,7 @@ var ts;
|
|
|
49531
49602
|
: undefined;
|
|
49532
49603
|
}
|
|
49533
49604
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49534
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49605
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49535
49606
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49536
49607
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49537
49608
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49552,7 +49623,7 @@ var ts;
|
|
|
49552
49623
|
((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
49553
49624
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49554
49625
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49555
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49626
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49556
49627
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49557
49628
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49558
49629
|
if (sourceFile) {
|
|
@@ -49565,6 +49636,9 @@ var ts;
|
|
|
49565
49636
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49566
49637
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
49567
49638
|
}
|
|
49639
|
+
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
49640
|
+
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
49641
|
+
}
|
|
49568
49642
|
}
|
|
49569
49643
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49570
49644
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -49615,6 +49689,10 @@ var ts;
|
|
|
49615
49689
|
}
|
|
49616
49690
|
else {
|
|
49617
49691
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
49692
|
+
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
49693
|
+
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
49694
|
+
var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
|
|
49695
|
+
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
49618
49696
|
if (tsExtension) {
|
|
49619
49697
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49620
49698
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49634,6 +49712,19 @@ var ts;
|
|
|
49634
49712
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49635
49713
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49636
49714
|
}
|
|
49715
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
|
|
49716
|
+
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
49717
|
+
var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
|
|
49718
|
+
var actualExt = _a[0], _importExt = _a[1];
|
|
49719
|
+
return host.fileExists(absoluteRef_1 + actualExt);
|
|
49720
|
+
})) === null || _g === void 0 ? void 0 : _g[1];
|
|
49721
|
+
if (suggestedExt) {
|
|
49722
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
49723
|
+
}
|
|
49724
|
+
else {
|
|
49725
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
49726
|
+
}
|
|
49727
|
+
}
|
|
49637
49728
|
else {
|
|
49638
49729
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49639
49730
|
}
|
|
@@ -49703,40 +49794,50 @@ var ts;
|
|
|
49703
49794
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
49704
49795
|
return symbol;
|
|
49705
49796
|
}
|
|
49706
|
-
|
|
49707
|
-
|
|
49708
|
-
|
|
49709
|
-
|
|
49710
|
-
|
|
49797
|
+
var referenceParent = referencingLocation.parent;
|
|
49798
|
+
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49799
|
+
ts.isImportCall(referenceParent)) {
|
|
49800
|
+
var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
|
49801
|
+
var type = getTypeOfSymbol(symbol);
|
|
49802
|
+
var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
|
49803
|
+
if (defaultOnlyType) {
|
|
49804
|
+
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
49805
|
+
}
|
|
49806
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
49711
49807
|
var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
49712
49808
|
if (!sigs || !sigs.length) {
|
|
49713
49809
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49714
49810
|
}
|
|
49715
|
-
if (sigs && sigs.length) {
|
|
49716
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol,
|
|
49717
|
-
|
|
49718
|
-
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49719
|
-
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49720
|
-
result.parent = symbol.parent;
|
|
49721
|
-
result.target = symbol;
|
|
49722
|
-
result.originatingImport = referenceParent;
|
|
49723
|
-
if (symbol.valueDeclaration)
|
|
49724
|
-
result.valueDeclaration = symbol.valueDeclaration;
|
|
49725
|
-
if (symbol.constEnumOnlyModule)
|
|
49726
|
-
result.constEnumOnlyModule = true;
|
|
49727
|
-
if (symbol.members)
|
|
49728
|
-
result.members = new ts.Map(symbol.members);
|
|
49729
|
-
if (symbol.exports)
|
|
49730
|
-
result.exports = new ts.Map(symbol.exports);
|
|
49731
|
-
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49732
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49733
|
-
return result;
|
|
49811
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49812
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49813
|
+
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49734
49814
|
}
|
|
49735
49815
|
}
|
|
49736
49816
|
}
|
|
49737
49817
|
}
|
|
49738
49818
|
return symbol;
|
|
49739
49819
|
}
|
|
49820
|
+
/**
|
|
49821
|
+
* Create a new symbol which has the module's type less the call and construct signatures
|
|
49822
|
+
*/
|
|
49823
|
+
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
|
49824
|
+
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49825
|
+
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49826
|
+
result.parent = symbol.parent;
|
|
49827
|
+
result.target = symbol;
|
|
49828
|
+
result.originatingImport = referenceParent;
|
|
49829
|
+
if (symbol.valueDeclaration)
|
|
49830
|
+
result.valueDeclaration = symbol.valueDeclaration;
|
|
49831
|
+
if (symbol.constEnumOnlyModule)
|
|
49832
|
+
result.constEnumOnlyModule = true;
|
|
49833
|
+
if (symbol.members)
|
|
49834
|
+
result.members = new ts.Map(symbol.members);
|
|
49835
|
+
if (symbol.exports)
|
|
49836
|
+
result.exports = new ts.Map(symbol.exports);
|
|
49837
|
+
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49838
|
+
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49839
|
+
return result;
|
|
49840
|
+
}
|
|
49740
49841
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
49741
49842
|
return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
|
|
49742
49843
|
}
|
|
@@ -61535,7 +61636,9 @@ var ts;
|
|
|
61535
61636
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
61536
61637
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61537
61638
|
if (!type.declaration.nameType) {
|
|
61538
|
-
|
|
61639
|
+
var constraint = void 0;
|
|
61640
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
61641
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61539
61642
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61540
61643
|
}
|
|
61541
61644
|
if (isGenericTupleType(t)) {
|
|
@@ -67182,8 +67285,11 @@ var ts;
|
|
|
67182
67285
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
67183
67286
|
switch (node.kind) {
|
|
67184
67287
|
case 79 /* Identifier */:
|
|
67185
|
-
|
|
67186
|
-
|
|
67288
|
+
if (!ts.isThisInTypeQuery(node)) {
|
|
67289
|
+
var symbol = getResolvedSymbol(node);
|
|
67290
|
+
return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
|
|
67291
|
+
}
|
|
67292
|
+
// falls through
|
|
67187
67293
|
case 108 /* ThisKeyword */:
|
|
67188
67294
|
return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
|
|
67189
67295
|
case 229 /* NonNullExpression */:
|
|
@@ -74912,11 +75018,33 @@ var ts;
|
|
|
74912
75018
|
if (moduleSymbol) {
|
|
74913
75019
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
|
|
74914
75020
|
if (esModuleSymbol) {
|
|
74915
|
-
return createPromiseReturnType(node,
|
|
75021
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
|
|
75022
|
+
getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
74916
75023
|
}
|
|
74917
75024
|
}
|
|
74918
75025
|
return createPromiseReturnType(node, anyType);
|
|
74919
75026
|
}
|
|
75027
|
+
function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
|
|
75028
|
+
var memberTable = ts.createSymbolTable();
|
|
75029
|
+
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
75030
|
+
newSymbol.parent = originalSymbol;
|
|
75031
|
+
newSymbol.nameType = getStringLiteralType("default");
|
|
75032
|
+
newSymbol.target = resolveSymbol(symbol);
|
|
75033
|
+
memberTable.set("default" /* Default */, newSymbol);
|
|
75034
|
+
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
75035
|
+
}
|
|
75036
|
+
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75037
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75038
|
+
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75039
|
+
var synthType = type;
|
|
75040
|
+
if (!synthType.defaultOnlyType) {
|
|
75041
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
75042
|
+
synthType.defaultOnlyType = type_4;
|
|
75043
|
+
}
|
|
75044
|
+
return synthType.defaultOnlyType;
|
|
75045
|
+
}
|
|
75046
|
+
return undefined;
|
|
75047
|
+
}
|
|
74920
75048
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74921
75049
|
var _a;
|
|
74922
75050
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
@@ -74925,14 +75053,8 @@ var ts;
|
|
|
74925
75053
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
74926
75054
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
|
|
74927
75055
|
if (hasSyntheticDefault) {
|
|
74928
|
-
var memberTable = ts.createSymbolTable();
|
|
74929
|
-
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74930
|
-
newSymbol.parent = originalSymbol;
|
|
74931
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
74932
|
-
newSymbol.target = resolveSymbol(symbol);
|
|
74933
|
-
memberTable.set("default" /* Default */, newSymbol);
|
|
74934
75056
|
var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
74935
|
-
var defaultContainingObject =
|
|
75057
|
+
var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
74936
75058
|
anonymousSymbol.type = defaultContainingObject;
|
|
74937
75059
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
|
|
74938
75060
|
}
|
|
@@ -75640,12 +75762,12 @@ var ts;
|
|
|
75640
75762
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
75641
75763
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
75642
75764
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
75643
|
-
var
|
|
75765
|
+
var type_5 = getBaseConstraintOfType(operandType) || operandType;
|
|
75644
75766
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
75645
|
-
if (
|
|
75767
|
+
if (type_5.flags & 3 /* AnyOrUnknown */) {
|
|
75646
75768
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
75647
75769
|
}
|
|
75648
|
-
return !!(filterType(
|
|
75770
|
+
return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
75649
75771
|
}
|
|
75650
75772
|
var type = getTypeOfExpression(node.expression);
|
|
75651
75773
|
if (!isLiteralType(type)) {
|
|
@@ -81615,7 +81737,7 @@ var ts;
|
|
|
81615
81737
|
checkKindsOfPropertyMemberOverrides(type, baseType_1);
|
|
81616
81738
|
}
|
|
81617
81739
|
}
|
|
81618
|
-
|
|
81740
|
+
checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
|
|
81619
81741
|
var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
|
|
81620
81742
|
if (implementedTypeNodes) {
|
|
81621
81743
|
for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
|
|
@@ -81650,8 +81772,7 @@ var ts;
|
|
|
81650
81772
|
checkPropertyInitialization(node);
|
|
81651
81773
|
}
|
|
81652
81774
|
}
|
|
81653
|
-
function
|
|
81654
|
-
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81775
|
+
function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
|
|
81655
81776
|
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81656
81777
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81657
81778
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
@@ -81663,46 +81784,71 @@ var ts;
|
|
|
81663
81784
|
if (ts.isConstructorDeclaration(member)) {
|
|
81664
81785
|
ts.forEach(member.parameters, function (param) {
|
|
81665
81786
|
if (ts.isParameterPropertyDeclaration(param, member)) {
|
|
81666
|
-
|
|
81787
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
|
|
81788
|
+
/* memberIsParameterProperty */ true);
|
|
81667
81789
|
}
|
|
81668
81790
|
});
|
|
81669
81791
|
}
|
|
81670
|
-
|
|
81792
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
|
|
81793
|
+
/* memberIsParameterProperty */ false);
|
|
81671
81794
|
};
|
|
81672
81795
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
81673
81796
|
var member = _a[_i];
|
|
81674
81797
|
_loop_29(member);
|
|
81675
81798
|
}
|
|
81676
|
-
|
|
81677
|
-
|
|
81678
|
-
|
|
81679
|
-
|
|
81680
|
-
|
|
81681
|
-
|
|
81682
|
-
|
|
81683
|
-
|
|
81684
|
-
|
|
81685
|
-
|
|
81686
|
-
|
|
81687
|
-
|
|
81688
|
-
|
|
81689
|
-
|
|
81690
|
-
|
|
81691
|
-
|
|
81799
|
+
}
|
|
81800
|
+
/**
|
|
81801
|
+
* @param member Existing member node to be checked.
|
|
81802
|
+
* Note: `member` cannot be a synthetic node.
|
|
81803
|
+
*/
|
|
81804
|
+
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
|
|
81805
|
+
if (reportErrors === void 0) { reportErrors = true; }
|
|
81806
|
+
var declaredProp = member.name
|
|
81807
|
+
&& getSymbolAtLocation(member.name)
|
|
81808
|
+
|| getSymbolAtLocation(member);
|
|
81809
|
+
if (!declaredProp) {
|
|
81810
|
+
return 0 /* Ok */;
|
|
81811
|
+
}
|
|
81812
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
|
|
81813
|
+
}
|
|
81814
|
+
/**
|
|
81815
|
+
* Checks a class member declaration for either a missing or an invalid `override` modifier.
|
|
81816
|
+
* Note: this function can be used for speculative checking,
|
|
81817
|
+
* i.e. checking a member that does not yet exist in the program.
|
|
81818
|
+
* An example of that would be to call this function in a completions scenario,
|
|
81819
|
+
* when offering a method declaration as completion.
|
|
81820
|
+
* @param errorNode The node where we should report an error, or undefined if we should not report errors.
|
|
81821
|
+
*/
|
|
81822
|
+
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
|
|
81823
|
+
var isJs = ts.isInJSFile(node);
|
|
81824
|
+
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81825
|
+
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
|
81826
|
+
var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
|
|
81827
|
+
var thisType = memberIsStatic ? staticType : typeWithThis;
|
|
81828
|
+
var baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
|
81829
|
+
var prop = getPropertyOfType(thisType, memberEscapedName);
|
|
81830
|
+
var baseProp = getPropertyOfType(baseType, memberEscapedName);
|
|
81831
|
+
var baseClassName = typeToString(baseWithThis);
|
|
81832
|
+
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
81833
|
+
if (errorNode) {
|
|
81834
|
+
var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); // Again, using symbol name: note that's different from `symbol.escapedName`
|
|
81692
81835
|
suggestion ?
|
|
81693
|
-
error(
|
|
81836
|
+
error(errorNode, isJs ?
|
|
81694
81837
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
|
|
81695
81838
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
|
|
81696
|
-
error(
|
|
81839
|
+
error(errorNode, isJs ?
|
|
81697
81840
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
81698
81841
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81699
81842
|
}
|
|
81700
|
-
|
|
81701
|
-
|
|
81702
|
-
|
|
81703
|
-
|
|
81704
|
-
|
|
81705
|
-
|
|
81843
|
+
return 2 /* HasInvalidOverride */;
|
|
81844
|
+
}
|
|
81845
|
+
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
81846
|
+
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
81847
|
+
if (memberHasOverrideModifier) {
|
|
81848
|
+
return 0 /* Ok */;
|
|
81849
|
+
}
|
|
81850
|
+
if (!baseHasAbstract) {
|
|
81851
|
+
if (errorNode) {
|
|
81706
81852
|
var diag = memberIsParameterProperty ?
|
|
81707
81853
|
isJs ?
|
|
81708
81854
|
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
@@ -81710,20 +81856,28 @@ var ts;
|
|
|
81710
81856
|
isJs ?
|
|
81711
81857
|
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
81712
81858
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81713
|
-
error(
|
|
81859
|
+
error(errorNode, diag, baseClassName);
|
|
81714
81860
|
}
|
|
81715
|
-
|
|
81716
|
-
|
|
81861
|
+
return 1 /* NeedsOverride */;
|
|
81862
|
+
}
|
|
81863
|
+
else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
81864
|
+
if (errorNode) {
|
|
81865
|
+
error(errorNode, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
|
|
81717
81866
|
}
|
|
81867
|
+
return 1 /* NeedsOverride */;
|
|
81718
81868
|
}
|
|
81719
81869
|
}
|
|
81720
|
-
|
|
81870
|
+
}
|
|
81871
|
+
else if (memberHasOverrideModifier) {
|
|
81872
|
+
if (errorNode) {
|
|
81721
81873
|
var className = typeToString(type);
|
|
81722
|
-
error(
|
|
81874
|
+
error(errorNode, isJs ?
|
|
81723
81875
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
81724
81876
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81725
81877
|
}
|
|
81878
|
+
return 2 /* HasInvalidOverride */;
|
|
81726
81879
|
}
|
|
81880
|
+
return 0 /* Ok */;
|
|
81727
81881
|
}
|
|
81728
81882
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
81729
81883
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
@@ -81766,6 +81920,31 @@ var ts;
|
|
|
81766
81920
|
}
|
|
81767
81921
|
}
|
|
81768
81922
|
}
|
|
81923
|
+
/**
|
|
81924
|
+
* Checks a member declaration node to see if has a missing or invalid `override` modifier.
|
|
81925
|
+
* @param node Class-like node where the member is declared.
|
|
81926
|
+
* @param member Member declaration node.
|
|
81927
|
+
* Note: `member` can be a synthetic node without a parent.
|
|
81928
|
+
*/
|
|
81929
|
+
function getMemberOverrideModifierStatus(node, member) {
|
|
81930
|
+
if (!member.name) {
|
|
81931
|
+
return 0 /* Ok */;
|
|
81932
|
+
}
|
|
81933
|
+
var symbol = getSymbolOfNode(node);
|
|
81934
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
81935
|
+
var typeWithThis = getTypeWithThisArgument(type);
|
|
81936
|
+
var staticType = getTypeOfSymbol(symbol);
|
|
81937
|
+
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81938
|
+
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81939
|
+
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
81940
|
+
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
81941
|
+
var memberHasOverrideModifier = member.parent
|
|
81942
|
+
? ts.hasOverrideModifier(member)
|
|
81943
|
+
: ts.hasSyntacticModifier(member, 16384 /* Override */);
|
|
81944
|
+
var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
|
|
81945
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member),
|
|
81946
|
+
/* memberIsParameterProperty */ false, memberName);
|
|
81947
|
+
}
|
|
81769
81948
|
function getTargetSymbol(s) {
|
|
81770
81949
|
// if symbol is instantiated its flags are not copied from the 'target'
|
|
81771
81950
|
// so we'll need to get back original 'target' symbol to work with correct set of flags
|
|
@@ -94762,11 +94941,11 @@ var ts;
|
|
|
94762
94941
|
currentFileState.filenameDeclaration = declaration;
|
|
94763
94942
|
return currentFileState.filenameDeclaration.name;
|
|
94764
94943
|
}
|
|
94765
|
-
function getJsxFactoryCalleePrimitive(
|
|
94766
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
94944
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
94945
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
94767
94946
|
}
|
|
94768
|
-
function getJsxFactoryCallee(
|
|
94769
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
94947
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
94948
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
94770
94949
|
return getImplicitImportForName(type);
|
|
94771
94950
|
}
|
|
94772
94951
|
function getImplicitJsxFragmentReference() {
|
|
@@ -94918,7 +95097,7 @@ var ts;
|
|
|
94918
95097
|
}
|
|
94919
95098
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
94920
95099
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
94921
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95100
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
94922
95101
|
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
94923
95102
|
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
94924
95103
|
}
|
|
@@ -94932,15 +95111,18 @@ var ts;
|
|
|
94932
95111
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
94933
95112
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
94934
95113
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
94935
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95114
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
94936
95115
|
}
|
|
94937
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95116
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95117
|
+
var _a;
|
|
95118
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95119
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
94938
95120
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
94939
95121
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
94940
95122
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
94941
95123
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
94942
95124
|
// isStaticChildren development flag
|
|
94943
|
-
args.push(
|
|
95125
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
94944
95126
|
// __source development flag
|
|
94945
95127
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
94946
95128
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -94952,7 +95134,7 @@ var ts;
|
|
|
94952
95134
|
args.push(factory.createThis());
|
|
94953
95135
|
}
|
|
94954
95136
|
}
|
|
94955
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95137
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
94956
95138
|
if (isChild) {
|
|
94957
95139
|
ts.startOnNewLine(element);
|
|
94958
95140
|
}
|
|
@@ -94982,7 +95164,7 @@ var ts;
|
|
|
94982
95164
|
}
|
|
94983
95165
|
}
|
|
94984
95166
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
94985
|
-
/*keyAttr*/ undefined,
|
|
95167
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
94986
95168
|
}
|
|
94987
95169
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
94988
95170
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -108070,7 +108252,14 @@ var ts;
|
|
|
108070
108252
|
// clear the parenthesizer rule as we ascend
|
|
108071
108253
|
currentParenthesizerRule = undefined;
|
|
108072
108254
|
}
|
|
108073
|
-
function pipelineEmitWithHintWorker(hint, node) {
|
|
108255
|
+
function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
|
|
108256
|
+
if (allowSnippets === void 0) { allowSnippets = true; }
|
|
108257
|
+
if (allowSnippets) {
|
|
108258
|
+
var snippet = ts.getSnippetElement(node);
|
|
108259
|
+
if (snippet) {
|
|
108260
|
+
return emitSnippetNode(hint, node, snippet);
|
|
108261
|
+
}
|
|
108262
|
+
}
|
|
108074
108263
|
if (hint === 0 /* SourceFile */)
|
|
108075
108264
|
return emitSourceFile(ts.cast(node, ts.isSourceFile));
|
|
108076
108265
|
if (hint === 2 /* IdentifierName */)
|
|
@@ -108679,6 +108868,28 @@ var ts;
|
|
|
108679
108868
|
}
|
|
108680
108869
|
}
|
|
108681
108870
|
//
|
|
108871
|
+
// Snippet Elements
|
|
108872
|
+
//
|
|
108873
|
+
function emitSnippetNode(hint, node, snippet) {
|
|
108874
|
+
switch (snippet.kind) {
|
|
108875
|
+
case 1 /* Placeholder */:
|
|
108876
|
+
emitPlaceholder(hint, node, snippet);
|
|
108877
|
+
break;
|
|
108878
|
+
case 0 /* TabStop */:
|
|
108879
|
+
emitTabStop(snippet);
|
|
108880
|
+
break;
|
|
108881
|
+
}
|
|
108882
|
+
}
|
|
108883
|
+
function emitPlaceholder(hint, node, snippet) {
|
|
108884
|
+
nonEscapingWrite("${" + snippet.order + ":"); // `${2:`
|
|
108885
|
+
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
|
|
108886
|
+
nonEscapingWrite("}"); // `}`
|
|
108887
|
+
// `${2:...}`
|
|
108888
|
+
}
|
|
108889
|
+
function emitTabStop(snippet) {
|
|
108890
|
+
nonEscapingWrite("$" + snippet.order);
|
|
108891
|
+
}
|
|
108892
|
+
//
|
|
108682
108893
|
// Identifiers
|
|
108683
108894
|
//
|
|
108684
108895
|
function emitIdentifier(node) {
|
|
@@ -110917,6 +111128,15 @@ var ts;
|
|
|
110917
111128
|
function writeProperty(s) {
|
|
110918
111129
|
writer.writeProperty(s);
|
|
110919
111130
|
}
|
|
111131
|
+
function nonEscapingWrite(s) {
|
|
111132
|
+
// This should be defined in a snippet-escaping text writer.
|
|
111133
|
+
if (writer.nonEscapingWrite) {
|
|
111134
|
+
writer.nonEscapingWrite(s);
|
|
111135
|
+
}
|
|
111136
|
+
else {
|
|
111137
|
+
writer.write(s);
|
|
111138
|
+
}
|
|
111139
|
+
}
|
|
110920
111140
|
function writeLine(count) {
|
|
110921
111141
|
if (count === void 0) { count = 1; }
|
|
110922
111142
|
for (var i = 0; i < count; i++) {
|
|
@@ -114020,8 +114240,8 @@ var ts;
|
|
|
114020
114240
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114021
114241
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114022
114242
|
// ensure that types resolutions are still correct
|
|
114023
|
-
var
|
|
114024
|
-
if (
|
|
114243
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114244
|
+
if (typeReferenceResolutionsChanged) {
|
|
114025
114245
|
structureIsReused = 1 /* SafeModules */;
|
|
114026
114246
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114027
114247
|
}
|
|
@@ -115309,6 +115529,21 @@ var ts;
|
|
|
115309
115529
|
return resolvedRef;
|
|
115310
115530
|
}
|
|
115311
115531
|
function verifyCompilerOptions() {
|
|
115532
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115533
|
+
if (!isNightly) {
|
|
115534
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115535
|
+
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|
|
115536
|
+
}
|
|
115537
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115538
|
+
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
|
|
115539
|
+
}
|
|
115540
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115541
|
+
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
|
|
115542
|
+
}
|
|
115543
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115544
|
+
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
|
|
115545
|
+
}
|
|
115546
|
+
}
|
|
115312
115547
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115313
115548
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115314
115549
|
}
|
|
@@ -115457,7 +115692,9 @@ var ts;
|
|
|
115457
115692
|
}
|
|
115458
115693
|
}
|
|
115459
115694
|
if (options.resolveJsonModule) {
|
|
115460
|
-
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs
|
|
115695
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
115696
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
|
|
115697
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
115461
115698
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
115462
115699
|
}
|
|
115463
115700
|
// Any emit other than common js, amd, es2015 or esnext is error
|
|
@@ -115785,8 +116022,8 @@ var ts;
|
|
|
115785
116022
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
115786
116023
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
115787
116024
|
}
|
|
115788
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
115789
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116025
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116026
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
115790
116027
|
}
|
|
115791
116028
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
115792
116029
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118030,6 +118267,9 @@ var ts;
|
|
|
118030
118267
|
else {
|
|
118031
118268
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118032
118269
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118270
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118271
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118272
|
+
}
|
|
118033
118273
|
}
|
|
118034
118274
|
resolutionsInFile.set(name, mode, resolution);
|
|
118035
118275
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118498,6 +118738,11 @@ var ts;
|
|
|
118498
118738
|
}
|
|
118499
118739
|
}
|
|
118500
118740
|
ts.createResolutionCache = createResolutionCache;
|
|
118741
|
+
function resolutionIsSymlink(resolution) {
|
|
118742
|
+
var _a, _b;
|
|
118743
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118744
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118745
|
+
}
|
|
118501
118746
|
})(ts || (ts = {}));
|
|
118502
118747
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118503
118748
|
/* @internal */
|
|
@@ -125552,6 +125797,16 @@ var ts;
|
|
|
125552
125797
|
return decisionFromFile !== null && decisionFromFile !== void 0 ? decisionFromFile : program.usesUriStyleNodeCoreModules;
|
|
125553
125798
|
}
|
|
125554
125799
|
ts.shouldUseUriStyleNodeCoreModules = shouldUseUriStyleNodeCoreModules;
|
|
125800
|
+
function getNewLineKind(newLineCharacter) {
|
|
125801
|
+
return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
|
|
125802
|
+
}
|
|
125803
|
+
ts.getNewLineKind = getNewLineKind;
|
|
125804
|
+
function diagnosticToString(diag) {
|
|
125805
|
+
return ts.isArray(diag)
|
|
125806
|
+
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
125807
|
+
: ts.getLocaleSpecificMessage(diag);
|
|
125808
|
+
}
|
|
125809
|
+
ts.diagnosticToString = diagnosticToString;
|
|
125555
125810
|
// #endregion
|
|
125556
125811
|
})(ts || (ts = {}));
|
|
125557
125812
|
/*@internal*/
|
|
@@ -127149,7 +127404,7 @@ var ts;
|
|
|
127149
127404
|
(function (Completions) {
|
|
127150
127405
|
var StringCompletions;
|
|
127151
127406
|
(function (StringCompletions) {
|
|
127152
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken,
|
|
127407
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
127153
127408
|
if (ts.isInReferenceComment(sourceFile, position)) {
|
|
127154
127409
|
var entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
127155
127410
|
return entries && convertPathCompletions(entries);
|
|
@@ -127157,12 +127412,12 @@ var ts;
|
|
|
127157
127412
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
127158
127413
|
if (!contextToken || !ts.isStringLiteralLike(contextToken))
|
|
127159
127414
|
return undefined;
|
|
127160
|
-
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
127161
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile,
|
|
127415
|
+
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
127416
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences);
|
|
127162
127417
|
}
|
|
127163
127418
|
}
|
|
127164
127419
|
StringCompletions.getStringLiteralCompletions = getStringLiteralCompletions;
|
|
127165
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile,
|
|
127420
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences) {
|
|
127166
127421
|
if (completion === undefined) {
|
|
127167
127422
|
return undefined;
|
|
127168
127423
|
}
|
|
@@ -127172,7 +127427,7 @@ var ts;
|
|
|
127172
127427
|
return convertPathCompletions(completion.paths);
|
|
127173
127428
|
case 1 /* Properties */: {
|
|
127174
127429
|
var entries = [];
|
|
127175
|
-
Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile,
|
|
127430
|
+
Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile, host, program, 99 /* ESNext */, log, 4 /* String */, preferences, options); // Target will not be used, so arbitrary
|
|
127176
127431
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries };
|
|
127177
127432
|
}
|
|
127178
127433
|
case 2 /* Types */: {
|
|
@@ -127898,6 +128153,8 @@ var ts;
|
|
|
127898
128153
|
(function (CompletionSource) {
|
|
127899
128154
|
/** Completions that require `this.` insertion text */
|
|
127900
128155
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128156
|
+
/** Auto-import that comes attached to a class member snippet */
|
|
128157
|
+
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
127901
128158
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
127902
128159
|
var SymbolOriginInfoKind;
|
|
127903
128160
|
(function (SymbolOriginInfoKind) {
|
|
@@ -128006,7 +128263,6 @@ var ts;
|
|
|
128006
128263
|
}
|
|
128007
128264
|
// If the request is a continuation of an earlier `isIncomplete` response,
|
|
128008
128265
|
// we can continue it from the cached previous response.
|
|
128009
|
-
var typeChecker = program.getTypeChecker();
|
|
128010
128266
|
var compilerOptions = program.getCompilerOptions();
|
|
128011
128267
|
var incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) === null || _a === void 0 ? void 0 : _a.call(host) : undefined;
|
|
128012
128268
|
if (incompleteCompletionsCache && completionKind === 3 /* TriggerForIncompleteCompletions */ && previousToken && ts.isIdentifier(previousToken)) {
|
|
@@ -128018,7 +128274,7 @@ var ts;
|
|
|
128018
128274
|
else {
|
|
128019
128275
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.clear();
|
|
128020
128276
|
}
|
|
128021
|
-
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken,
|
|
128277
|
+
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
128022
128278
|
if (stringCompletions) {
|
|
128023
128279
|
return stringCompletions;
|
|
128024
128280
|
}
|
|
@@ -128032,7 +128288,7 @@ var ts;
|
|
|
128032
128288
|
}
|
|
128033
128289
|
switch (completionData.kind) {
|
|
128034
128290
|
case 0 /* Data */:
|
|
128035
|
-
var response = completionInfoFromData(sourceFile,
|
|
128291
|
+
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences);
|
|
128036
128292
|
if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
|
|
128037
128293
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
|
|
128038
128294
|
}
|
|
@@ -128129,7 +128385,7 @@ var ts;
|
|
|
128129
128385
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
128130
128386
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
128131
128387
|
}
|
|
128132
|
-
function completionInfoFromData(sourceFile,
|
|
128388
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences) {
|
|
128133
128389
|
var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextIdMap = completionData.symbolToSortTextIdMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
|
|
128134
128390
|
// Verify if the file is JSX language variant
|
|
128135
128391
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
|
|
@@ -128141,7 +128397,7 @@ var ts;
|
|
|
128141
128397
|
var entries = [];
|
|
128142
128398
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
128143
128399
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
128144
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128400
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128145
128401
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217
|
|
128146
128402
|
}
|
|
128147
128403
|
else {
|
|
@@ -128149,7 +128405,7 @@ var ts;
|
|
|
128149
128405
|
return undefined;
|
|
128150
128406
|
}
|
|
128151
128407
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
128152
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128408
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128153
128409
|
}
|
|
128154
128410
|
if (keywordFilters !== 0 /* None */) {
|
|
128155
128411
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -128255,14 +128511,16 @@ var ts;
|
|
|
128255
128511
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
128256
128512
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
128257
128513
|
}
|
|
128258
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
128259
|
-
var _a;
|
|
128514
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind) {
|
|
128515
|
+
var _a, _b;
|
|
128260
128516
|
var insertText;
|
|
128261
128517
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
128262
128518
|
var data;
|
|
128263
128519
|
var isSnippet;
|
|
128520
|
+
var source = getSourceFromOrigin(origin);
|
|
128264
128521
|
var sourceDisplay;
|
|
128265
128522
|
var hasAction;
|
|
128523
|
+
var typeChecker = program.getTypeChecker();
|
|
128266
128524
|
var insertQuestionDot = origin && originIsNullableMember(origin);
|
|
128267
128525
|
var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
|
|
128268
128526
|
if (origin && originIsThisType(origin)) {
|
|
@@ -128313,12 +128571,16 @@ var ts;
|
|
|
128313
128571
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
128314
128572
|
}
|
|
128315
128573
|
}
|
|
128316
|
-
if (
|
|
128317
|
-
|
|
128318
|
-
|
|
128319
|
-
|
|
128320
|
-
|
|
128321
|
-
|
|
128574
|
+
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
128575
|
+
preferences.includeCompletionsWithInsertText &&
|
|
128576
|
+
completionKind === 3 /* MemberLike */ &&
|
|
128577
|
+
isClassLikeMemberCompletion(symbol, location)) {
|
|
128578
|
+
var importAdder = void 0;
|
|
128579
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
128580
|
+
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
128581
|
+
hasAction = true;
|
|
128582
|
+
source = CompletionSource.ClassMemberSnippet;
|
|
128583
|
+
}
|
|
128322
128584
|
}
|
|
128323
128585
|
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
|
|
128324
128586
|
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
@@ -128330,7 +128592,7 @@ var ts;
|
|
|
128330
128592
|
&& !(type.flags & 1048576 /* Union */ && ts.find(type.types, function (type) { return !!(type.flags & 528 /* BooleanLike */); }))) {
|
|
128331
128593
|
if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
|
|
128332
128594
|
// If is string like or undefined use quotes
|
|
128333
|
-
insertText = escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
128595
|
+
insertText = ts.escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
128334
128596
|
isSnippet = true;
|
|
128335
128597
|
}
|
|
128336
128598
|
else {
|
|
@@ -128339,13 +128601,20 @@ var ts;
|
|
|
128339
128601
|
}
|
|
128340
128602
|
}
|
|
128341
128603
|
if (useBraces_1) {
|
|
128342
|
-
insertText = escapeSnippetText(name) + "={$1}";
|
|
128604
|
+
insertText = ts.escapeSnippetText(name) + "={$1}";
|
|
128343
128605
|
isSnippet = true;
|
|
128344
128606
|
}
|
|
128345
128607
|
if (isSnippet) {
|
|
128346
128608
|
replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
|
|
128347
128609
|
}
|
|
128348
128610
|
}
|
|
128611
|
+
if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
|
|
128612
|
+
return undefined;
|
|
128613
|
+
}
|
|
128614
|
+
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
128615
|
+
data = originToCompletionEntryData(origin);
|
|
128616
|
+
hasAction = !importCompletionNode;
|
|
128617
|
+
}
|
|
128349
128618
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
128350
128619
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
128351
128620
|
// really we should consider passing the meaning for the node so that we don't report
|
|
@@ -128358,7 +128627,7 @@ var ts;
|
|
|
128358
128627
|
kind: kind,
|
|
128359
128628
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
128360
128629
|
sortText: sortText,
|
|
128361
|
-
source:
|
|
128630
|
+
source: source,
|
|
128362
128631
|
hasAction: hasAction ? true : undefined,
|
|
128363
128632
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
|
|
128364
128633
|
insertText: insertText,
|
|
@@ -128370,8 +128639,172 @@ var ts;
|
|
|
128370
128639
|
data: data,
|
|
128371
128640
|
};
|
|
128372
128641
|
}
|
|
128373
|
-
function
|
|
128374
|
-
|
|
128642
|
+
function isClassLikeMemberCompletion(symbol, location) {
|
|
128643
|
+
// TODO: support JS files.
|
|
128644
|
+
if (ts.isInJSFile(location)) {
|
|
128645
|
+
return false;
|
|
128646
|
+
}
|
|
128647
|
+
// Completion symbol must be for a class member.
|
|
128648
|
+
var memberFlags = 106500 /* ClassMember */
|
|
128649
|
+
& 900095 /* EnumMemberExcludes */;
|
|
128650
|
+
/* In
|
|
128651
|
+
`class C {
|
|
128652
|
+
|
|
|
128653
|
+
}`
|
|
128654
|
+
`location` is a class-like declaration.
|
|
128655
|
+
In
|
|
128656
|
+
`class C {
|
|
128657
|
+
m|
|
|
128658
|
+
}`
|
|
128659
|
+
`location` is an identifier,
|
|
128660
|
+
`location.parent` is a class element declaration,
|
|
128661
|
+
and `location.parent.parent` is a class-like declaration.
|
|
128662
|
+
In
|
|
128663
|
+
`abstract class C {
|
|
128664
|
+
abstract
|
|
128665
|
+
abstract m|
|
|
128666
|
+
}`
|
|
128667
|
+
`location` is a syntax list (with modifiers as children),
|
|
128668
|
+
and `location.parent` is a class-like declaration.
|
|
128669
|
+
*/
|
|
128670
|
+
return !!(symbol.flags & memberFlags) &&
|
|
128671
|
+
(ts.isClassLike(location) ||
|
|
128672
|
+
(location.parent &&
|
|
128673
|
+
location.parent.parent &&
|
|
128674
|
+
ts.isClassElement(location.parent) &&
|
|
128675
|
+
location === location.parent.name &&
|
|
128676
|
+
ts.isClassLike(location.parent.parent)) ||
|
|
128677
|
+
(location.parent &&
|
|
128678
|
+
ts.isSyntaxList(location) &&
|
|
128679
|
+
ts.isClassLike(location.parent)));
|
|
128680
|
+
}
|
|
128681
|
+
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken) {
|
|
128682
|
+
var classLikeDeclaration = ts.findAncestor(location, ts.isClassLike);
|
|
128683
|
+
if (!classLikeDeclaration) {
|
|
128684
|
+
return { insertText: name };
|
|
128685
|
+
}
|
|
128686
|
+
var isSnippet;
|
|
128687
|
+
var insertText = name;
|
|
128688
|
+
var checker = program.getTypeChecker();
|
|
128689
|
+
var sourceFile = location.getSourceFile();
|
|
128690
|
+
var printer = createSnippetPrinter({
|
|
128691
|
+
removeComments: true,
|
|
128692
|
+
module: options.module,
|
|
128693
|
+
target: options.target,
|
|
128694
|
+
omitTrailingSemicolon: true,
|
|
128695
|
+
newLine: ts.getNewLineKind(ts.getNewLineCharacter(options, ts.maybeBind(host, host.getNewLine))),
|
|
128696
|
+
});
|
|
128697
|
+
var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
|
|
128698
|
+
var body;
|
|
128699
|
+
if (preferences.includeCompletionsWithSnippetText) {
|
|
128700
|
+
isSnippet = true;
|
|
128701
|
+
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
|
|
128702
|
+
// if it has one, so that the cursor ends up in the body once the completion is inserted.
|
|
128703
|
+
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
|
|
128704
|
+
var emptyStatement = ts.factory.createExpressionStatement(ts.factory.createIdentifier(""));
|
|
128705
|
+
ts.setSnippetElement(emptyStatement, { kind: 0 /* TabStop */, order: 0 });
|
|
128706
|
+
body = ts.factory.createBlock([emptyStatement], /* multiline */ true);
|
|
128707
|
+
}
|
|
128708
|
+
else {
|
|
128709
|
+
body = ts.factory.createBlock([], /* multiline */ true);
|
|
128710
|
+
}
|
|
128711
|
+
var modifiers = 0 /* None */;
|
|
128712
|
+
// Whether the suggested member should be abstract.
|
|
128713
|
+
// e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
|
|
128714
|
+
// Note: We are relying on checking if the context token is `abstract`,
|
|
128715
|
+
// since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
|
|
128716
|
+
// However, that is not true for the e.g. `override` modifier, so this check has its limitations.
|
|
128717
|
+
var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
|
|
128718
|
+
var completionNodes = [];
|
|
128719
|
+
ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
|
|
128720
|
+
// `addNewNodeForMemberSymbol` calls this callback function for each new member node
|
|
128721
|
+
// it adds for the given member symbol.
|
|
128722
|
+
// We store these member nodes in the `completionNodes` array.
|
|
128723
|
+
// Note: there might be:
|
|
128724
|
+
// - No nodes if `addNewNodeForMemberSymbol` cannot figure out a node for the member;
|
|
128725
|
+
// - One node;
|
|
128726
|
+
// - More than one node if the member is overloaded (e.g. a method with overload signatures).
|
|
128727
|
+
function (node) {
|
|
128728
|
+
var requiredModifiers = 0 /* None */;
|
|
128729
|
+
if (isAbstract) {
|
|
128730
|
+
requiredModifiers |= 128 /* Abstract */;
|
|
128731
|
+
}
|
|
128732
|
+
if (ts.isClassElement(node)
|
|
128733
|
+
&& checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
128734
|
+
requiredModifiers |= 16384 /* Override */;
|
|
128735
|
+
}
|
|
128736
|
+
var presentModifiers = 0 /* None */;
|
|
128737
|
+
if (!completionNodes.length) {
|
|
128738
|
+
// Omit already present modifiers from the first completion node/signature.
|
|
128739
|
+
if (contextToken) {
|
|
128740
|
+
presentModifiers = getPresentModifiers(contextToken);
|
|
128741
|
+
}
|
|
128742
|
+
// Keep track of added missing required modifiers and modifiers already present.
|
|
128743
|
+
// This is needed when we have overloaded signatures,
|
|
128744
|
+
// so this callback will be called for multiple nodes/signatures,
|
|
128745
|
+
// and we need to make sure the modifiers are uniform for all nodes/signatures.
|
|
128746
|
+
modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
|
|
128747
|
+
}
|
|
128748
|
+
node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
|
|
128749
|
+
completionNodes.push(node);
|
|
128750
|
+
}, body, isAbstract);
|
|
128751
|
+
if (completionNodes.length) {
|
|
128752
|
+
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
128753
|
+
}
|
|
128754
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
128755
|
+
}
|
|
128756
|
+
function getPresentModifiers(contextToken) {
|
|
128757
|
+
var modifiers = 0 /* None */;
|
|
128758
|
+
var contextMod;
|
|
128759
|
+
/*
|
|
128760
|
+
Cases supported:
|
|
128761
|
+
In
|
|
128762
|
+
`class C {
|
|
128763
|
+
public abstract |
|
|
128764
|
+
}`
|
|
128765
|
+
`contextToken` is ``abstract`` (as an identifier),
|
|
128766
|
+
`contextToken.parent` is property declaration,
|
|
128767
|
+
`location` is class declaration ``class C { ... }``.
|
|
128768
|
+
In
|
|
128769
|
+
`class C {
|
|
128770
|
+
protected override m|
|
|
128771
|
+
}`
|
|
128772
|
+
`contextToken` is ``override`` (as a keyword),
|
|
128773
|
+
`contextToken.parent` is property declaration,
|
|
128774
|
+
`location` is identifier ``m``,
|
|
128775
|
+
`location.parent` is property declaration ``protected override m``,
|
|
128776
|
+
`location.parent.parent` is class declaration ``class C { ... }``.
|
|
128777
|
+
*/
|
|
128778
|
+
if (contextMod = isModifierLike(contextToken)) {
|
|
128779
|
+
modifiers |= ts.modifierToFlag(contextMod);
|
|
128780
|
+
}
|
|
128781
|
+
if (ts.isPropertyDeclaration(contextToken.parent)) {
|
|
128782
|
+
modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
|
|
128783
|
+
}
|
|
128784
|
+
return modifiers;
|
|
128785
|
+
}
|
|
128786
|
+
function isModifierLike(node) {
|
|
128787
|
+
if (ts.isModifier(node)) {
|
|
128788
|
+
return node.kind;
|
|
128789
|
+
}
|
|
128790
|
+
if (ts.isIdentifier(node) && node.originalKeywordKind && ts.isModifierKind(node.originalKeywordKind)) {
|
|
128791
|
+
return node.originalKeywordKind;
|
|
128792
|
+
}
|
|
128793
|
+
return undefined;
|
|
128794
|
+
}
|
|
128795
|
+
function createSnippetPrinter(printerOptions) {
|
|
128796
|
+
var printer = ts.createPrinter(printerOptions);
|
|
128797
|
+
var baseWriter = ts.createTextWriter(ts.getNewLineCharacter(printerOptions));
|
|
128798
|
+
var writer = __assign(__assign({}, baseWriter), { write: function (s) { return baseWriter.write(ts.escapeSnippetText(s)); }, nonEscapingWrite: baseWriter.write, writeLiteral: function (s) { return baseWriter.writeLiteral(ts.escapeSnippetText(s)); }, writeStringLiteral: function (s) { return baseWriter.writeStringLiteral(ts.escapeSnippetText(s)); }, writeSymbol: function (s, symbol) { return baseWriter.writeSymbol(ts.escapeSnippetText(s), symbol); }, writeParameter: function (s) { return baseWriter.writeParameter(ts.escapeSnippetText(s)); }, writeComment: function (s) { return baseWriter.writeComment(ts.escapeSnippetText(s)); }, writeProperty: function (s) { return baseWriter.writeProperty(ts.escapeSnippetText(s)); } });
|
|
128799
|
+
return {
|
|
128800
|
+
printSnippetList: printSnippetList,
|
|
128801
|
+
};
|
|
128802
|
+
/* Snippet-escaping version of `printer.printList`. */
|
|
128803
|
+
function printSnippetList(format, list, sourceFile) {
|
|
128804
|
+
writer.clear();
|
|
128805
|
+
printer.writeList(format, list, sourceFile, writer);
|
|
128806
|
+
return writer.getText();
|
|
128807
|
+
}
|
|
128375
128808
|
}
|
|
128376
128809
|
function originToCompletionEntryData(origin) {
|
|
128377
128810
|
var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
|
|
@@ -128439,10 +128872,10 @@ var ts;
|
|
|
128439
128872
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? ts.tokenToString(151 /* TypeKeyword */) + " " : "";
|
|
128440
128873
|
var suffix = useSemicolons ? ";" : "";
|
|
128441
128874
|
switch (importKind) {
|
|
128442
|
-
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
128443
|
-
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
128444
|
-
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
128445
|
-
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
128875
|
+
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
128876
|
+
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
128877
|
+
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + ts.escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
128878
|
+
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
128446
128879
|
}
|
|
128447
128880
|
}
|
|
128448
128881
|
function quotePropertyName(sourceFile, preferences, name) {
|
|
@@ -128466,11 +128899,12 @@ var ts;
|
|
|
128466
128899
|
return CompletionSource.ThisProperty;
|
|
128467
128900
|
}
|
|
128468
128901
|
}
|
|
128469
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile,
|
|
128902
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap) {
|
|
128470
128903
|
var _a;
|
|
128471
128904
|
var start = ts.timestamp();
|
|
128472
128905
|
var variableDeclaration = getVariableDeclaration(location);
|
|
128473
128906
|
var useSemicolons = ts.probablyUsesSemicolons(sourceFile);
|
|
128907
|
+
var typeChecker = program.getTypeChecker();
|
|
128474
128908
|
// Tracks unique names.
|
|
128475
128909
|
// Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
|
|
128476
128910
|
// true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
|
|
@@ -128486,7 +128920,7 @@ var ts;
|
|
|
128486
128920
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
128487
128921
|
var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
|
|
128488
128922
|
var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
|
|
128489
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
128923
|
+
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind);
|
|
128490
128924
|
if (!entry) {
|
|
128491
128925
|
continue;
|
|
128492
128926
|
}
|
|
@@ -128579,11 +129013,13 @@ var ts;
|
|
|
128579
129013
|
if (entryId.data) {
|
|
128580
129014
|
var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
128581
129015
|
if (autoImport) {
|
|
129016
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
|
|
128582
129017
|
return {
|
|
128583
129018
|
type: "symbol",
|
|
128584
129019
|
symbol: autoImport.symbol,
|
|
128585
129020
|
location: ts.getTouchingPropertyName(sourceFile, position),
|
|
128586
|
-
previousToken:
|
|
129021
|
+
previousToken: previousToken_1,
|
|
129022
|
+
contextToken: contextToken_1,
|
|
128587
129023
|
isJsxInitializer: false,
|
|
128588
129024
|
isTypeOnlyLocation: false,
|
|
128589
129025
|
origin: autoImport.origin,
|
|
@@ -128598,7 +129034,7 @@ var ts;
|
|
|
128598
129034
|
if (completionData.kind !== 0 /* Data */) {
|
|
128599
129035
|
return { type: "request", request: completionData };
|
|
128600
129036
|
}
|
|
128601
|
-
var symbols = completionData.symbols, literals = completionData.literals, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation;
|
|
129037
|
+
var symbols = completionData.symbols, literals = completionData.literals, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, contextToken = completionData.contextToken, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation;
|
|
128602
129038
|
var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
|
|
128603
129039
|
if (literal !== undefined)
|
|
128604
129040
|
return { type: "literal", literal: literal };
|
|
@@ -128609,15 +129045,15 @@ var ts;
|
|
|
128609
129045
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
128610
129046
|
var origin = symbolToOriginInfoMap[index];
|
|
128611
129047
|
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
128612
|
-
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
128613
|
-
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129048
|
+
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 /* ClassMember */ || getSourceFromOrigin(origin) === entryId.source)
|
|
129049
|
+
? { type: "symbol", symbol: symbol, location: location, origin: origin, contextToken: contextToken, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
128614
129050
|
: undefined;
|
|
128615
129051
|
}) || { type: "none" };
|
|
128616
129052
|
}
|
|
128617
129053
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
128618
129054
|
var typeChecker = program.getTypeChecker();
|
|
128619
129055
|
var compilerOptions = program.getCompilerOptions();
|
|
128620
|
-
var name = entryId.name;
|
|
129056
|
+
var name = entryId.name, source = entryId.source, data = entryId.data;
|
|
128621
129057
|
var contextToken = ts.findPrecedingToken(position, sourceFile);
|
|
128622
129058
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
128623
129059
|
return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
@@ -128641,8 +129077,8 @@ var ts;
|
|
|
128641
129077
|
}
|
|
128642
129078
|
}
|
|
128643
129079
|
case "symbol": {
|
|
128644
|
-
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
128645
|
-
var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences,
|
|
129080
|
+
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129081
|
+
var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay;
|
|
128646
129082
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
|
|
128647
129083
|
}
|
|
128648
129084
|
case "literal": {
|
|
@@ -128671,14 +129107,27 @@ var ts;
|
|
|
128671
129107
|
return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
|
|
128672
129108
|
}
|
|
128673
129109
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
128674
|
-
function getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data) {
|
|
129110
|
+
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
|
|
128675
129111
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
128676
|
-
var _a = getRelevantTokens(position, sourceFile),
|
|
128677
|
-
if (
|
|
129112
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
|
|
129113
|
+
if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
|
|
128678
129114
|
// Import statement completion: 'import c|'
|
|
128679
129115
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
128680
129116
|
}
|
|
128681
129117
|
}
|
|
129118
|
+
if (source === CompletionSource.ClassMemberSnippet) {
|
|
129119
|
+
var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken).importAdder;
|
|
129120
|
+
if (importAdder) {
|
|
129121
|
+
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
129122
|
+
return {
|
|
129123
|
+
sourceDisplay: undefined,
|
|
129124
|
+
codeActions: [{
|
|
129125
|
+
changes: changes,
|
|
129126
|
+
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
129127
|
+
}],
|
|
129128
|
+
};
|
|
129129
|
+
}
|
|
129130
|
+
}
|
|
128682
129131
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
128683
129132
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
128684
129133
|
}
|
|
@@ -144519,7 +144968,7 @@ var ts;
|
|
|
144519
144968
|
/** Note: output node may be mutated input node. */
|
|
144520
144969
|
function getNonformattedText(node, sourceFile, newLineCharacter) {
|
|
144521
144970
|
var writer = createWriter(newLineCharacter);
|
|
144522
|
-
var newLine = newLineCharacter
|
|
144971
|
+
var newLine = ts.getNewLineKind(newLineCharacter);
|
|
144523
144972
|
ts.createPrinter({
|
|
144524
144973
|
newLine: newLine,
|
|
144525
144974
|
neverAsciiEscape: true,
|
|
@@ -144984,21 +145433,16 @@ var ts;
|
|
|
144984
145433
|
(function (codefix) {
|
|
144985
145434
|
var errorCodeToFixes = ts.createMultiMap();
|
|
144986
145435
|
var fixIdToRegistration = new ts.Map();
|
|
144987
|
-
function diagnosticToString(diag) {
|
|
144988
|
-
return ts.isArray(diag)
|
|
144989
|
-
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
144990
|
-
: ts.getLocaleSpecificMessage(diag);
|
|
144991
|
-
}
|
|
144992
145436
|
function createCodeFixActionWithoutFixAll(fixName, changes, description) {
|
|
144993
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145437
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
144994
145438
|
}
|
|
144995
145439
|
codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
|
|
144996
145440
|
function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
144997
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
|
|
145441
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
|
|
144998
145442
|
}
|
|
144999
145443
|
codefix.createCodeFixAction = createCodeFixAction;
|
|
145000
145444
|
function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145001
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
145445
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, fixAllDescription && ts.diagnosticToString(fixAllDescription), command);
|
|
145002
145446
|
}
|
|
145003
145447
|
codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
|
|
145004
145448
|
function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
|
|
@@ -147759,7 +148203,7 @@ var ts;
|
|
|
147759
148203
|
var addToExisting = new ts.Map();
|
|
147760
148204
|
/** Use `getNewImportEntry` for access */
|
|
147761
148205
|
var newImports = new ts.Map();
|
|
147762
|
-
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
|
|
148206
|
+
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
147763
148207
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
147764
148208
|
var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
147765
148209
|
if (!info || !info.fixes.length)
|
|
@@ -147910,6 +148354,9 @@ var ts;
|
|
|
147910
148354
|
ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
|
|
147911
148355
|
}
|
|
147912
148356
|
}
|
|
148357
|
+
function hasFixes() {
|
|
148358
|
+
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
|
|
148359
|
+
}
|
|
147913
148360
|
}
|
|
147914
148361
|
// Sorted with the preferred fix coming first.
|
|
147915
148362
|
var ImportFixKind;
|
|
@@ -152120,7 +152567,7 @@ var ts;
|
|
|
152120
152567
|
for (var _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) {
|
|
152121
152568
|
var symbol = possiblyMissingSymbols_1[_i];
|
|
152122
152569
|
if (!classMembers.has(symbol.escapedName)) {
|
|
152123
|
-
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement);
|
|
152570
|
+
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement, /* body */ undefined);
|
|
152124
152571
|
}
|
|
152125
152572
|
}
|
|
152126
152573
|
}
|
|
@@ -152133,9 +152580,11 @@ var ts;
|
|
|
152133
152580
|
}
|
|
152134
152581
|
codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
|
|
152135
152582
|
/**
|
|
152136
|
-
*
|
|
152583
|
+
* `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
|
|
152584
|
+
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
152137
152585
|
*/
|
|
152138
|
-
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement) {
|
|
152586
|
+
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, isAmbient) {
|
|
152587
|
+
if (isAmbient === void 0) { isAmbient = false; }
|
|
152139
152588
|
var declarations = symbol.getDeclarations();
|
|
152140
152589
|
if (!(declarations && declarations.length)) {
|
|
152141
152590
|
return undefined;
|
|
@@ -152148,7 +152597,7 @@ var ts;
|
|
|
152148
152597
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
152149
152598
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
152150
152599
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
152151
|
-
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */);
|
|
152600
|
+
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */) || isAmbient;
|
|
152152
152601
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
152153
152602
|
switch (declaration.kind) {
|
|
152154
152603
|
case 165 /* PropertySignature */:
|
|
@@ -152184,14 +152633,14 @@ var ts;
|
|
|
152184
152633
|
var accessor = orderedAccessors_1[_i];
|
|
152185
152634
|
if (ts.isGetAccessorDeclaration(accessor)) {
|
|
152186
152635
|
addClassElement(ts.factory.createGetAccessorDeclaration(
|
|
152187
|
-
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
152636
|
+
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152188
152637
|
}
|
|
152189
152638
|
else {
|
|
152190
152639
|
ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter");
|
|
152191
152640
|
var parameter = ts.getSetAccessorValueParameter(accessor);
|
|
152192
152641
|
var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
|
|
152193
152642
|
addClassElement(ts.factory.createSetAccessorDeclaration(
|
|
152194
|
-
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
152643
|
+
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152195
152644
|
}
|
|
152196
152645
|
}
|
|
152197
152646
|
break;
|
|
@@ -152212,7 +152661,7 @@ var ts;
|
|
|
152212
152661
|
if (declarations.length === 1) {
|
|
152213
152662
|
ts.Debug.assert(signatures.length === 1, "One declaration implies one signature");
|
|
152214
152663
|
var signature = signatures[0];
|
|
152215
|
-
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(quotePreference));
|
|
152664
|
+
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
152216
152665
|
break;
|
|
152217
152666
|
}
|
|
152218
152667
|
for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
|
|
@@ -152223,11 +152672,11 @@ var ts;
|
|
|
152223
152672
|
if (!ambient) {
|
|
152224
152673
|
if (declarations.length > signatures.length) {
|
|
152225
152674
|
var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
|
|
152226
|
-
outputMethod(quotePreference, signature, modifiers, name, createStubbedMethodBody(quotePreference));
|
|
152675
|
+
outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference));
|
|
152227
152676
|
}
|
|
152228
152677
|
else {
|
|
152229
152678
|
ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
|
|
152230
|
-
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference));
|
|
152679
|
+
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
|
|
152231
152680
|
}
|
|
152232
152681
|
}
|
|
152233
152682
|
break;
|
|
@@ -152238,6 +152687,7 @@ var ts;
|
|
|
152238
152687
|
addClassElement(method);
|
|
152239
152688
|
}
|
|
152240
152689
|
}
|
|
152690
|
+
codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol;
|
|
152241
152691
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
152242
152692
|
var program = context.program;
|
|
152243
152693
|
var checker = program.getTypeChecker();
|
|
@@ -152375,7 +152825,7 @@ var ts;
|
|
|
152375
152825
|
}
|
|
152376
152826
|
return parameters;
|
|
152377
152827
|
}
|
|
152378
|
-
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference) {
|
|
152828
|
+
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body) {
|
|
152379
152829
|
/** This is *a* signature with the maximal number of arguments,
|
|
152380
152830
|
* such that if there is a "maximal" signature without rest arguments,
|
|
152381
152831
|
* this is one of them.
|
|
@@ -152406,7 +152856,7 @@ var ts;
|
|
|
152406
152856
|
parameters.push(restParameter);
|
|
152407
152857
|
}
|
|
152408
152858
|
return createStubbedMethod(modifiers, name, optional,
|
|
152409
|
-
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference);
|
|
152859
|
+
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference, body);
|
|
152410
152860
|
}
|
|
152411
152861
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
152412
152862
|
if (ts.length(signatures)) {
|
|
@@ -152414,10 +152864,10 @@ var ts;
|
|
|
152414
152864
|
return checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
152415
152865
|
}
|
|
152416
152866
|
}
|
|
152417
|
-
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference) {
|
|
152867
|
+
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
152418
152868
|
return ts.factory.createMethodDeclaration(
|
|
152419
152869
|
/*decorators*/ undefined, modifiers,
|
|
152420
|
-
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody(quotePreference));
|
|
152870
|
+
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, body || createStubbedMethodBody(quotePreference));
|
|
152421
152871
|
}
|
|
152422
152872
|
function createStubbedMethodBody(quotePreference) {
|
|
152423
152873
|
return createStubbedBody(ts.Diagnostics.Method_not_implemented.message, quotePreference);
|
|
@@ -164453,6 +164903,10 @@ var ts;
|
|
|
164453
164903
|
this.hasAddedOrRemovedSymlinks = true;
|
|
164454
164904
|
}
|
|
164455
164905
|
};
|
|
164906
|
+
/* @internal */
|
|
164907
|
+
Project.prototype.onDiscoveredSymlink = function () {
|
|
164908
|
+
this.hasAddedOrRemovedSymlinks = true;
|
|
164909
|
+
};
|
|
164456
164910
|
/**
|
|
164457
164911
|
* Updates set of files that contribute to this project
|
|
164458
164912
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|