typescript 4.5.0-dev.20211029 → 4.5.0-dev.20211030
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/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +76 -17
- package/lib/tsserver.js +144 -81
- package/lib/tsserverlibrary.js +144 -81
- package/lib/typescript.js +140 -81
- package/lib/typescriptServices.js +140 -81
- package/lib/typingsInstaller.js +82 -19
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211030";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5320,7 +5320,7 @@ var ts;
|
|
|
5320
5320
|
(function (ModuleResolutionKind) {
|
|
5321
5321
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5322
5322
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5323
|
-
// Starting with node12, node's module resolver has significant departures from
|
|
5323
|
+
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5324
5324
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5325
5325
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5326
5326
|
// version-anchored resolution target
|
|
@@ -8898,6 +8898,8 @@ var ts;
|
|
|
8898
8898
|
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'."),
|
|
8899
8899
|
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."),
|
|
8900
8900
|
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}'?"),
|
|
8901
|
+
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."),
|
|
8902
|
+
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}'?"),
|
|
8901
8903
|
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}'."),
|
|
8902
8904
|
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}'."),
|
|
8903
8905
|
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}'."),
|
|
@@ -9004,6 +9006,7 @@ var ts;
|
|
|
9004
9006
|
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."),
|
|
9005
9007
|
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}'."),
|
|
9006
9008
|
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}'?"),
|
|
9009
|
+
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'."),
|
|
9007
9010
|
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."),
|
|
9008
9011
|
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."),
|
|
9009
9012
|
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}'."),
|
|
@@ -9661,6 +9664,7 @@ var ts;
|
|
|
9661
9664
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9662
9665
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9663
9666
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9667
|
+
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}'"),
|
|
9664
9668
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9665
9669
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9666
9670
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -47562,6 +47566,21 @@ var ts;
|
|
|
47562
47566
|
var enumRelation = new ts.Map();
|
|
47563
47567
|
var builtinGlobals = ts.createSymbolTable();
|
|
47564
47568
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
47569
|
+
// Extensions suggested for path imports when module resolution is node12 or higher.
|
|
47570
|
+
// The first element of each tuple is the extension a file has.
|
|
47571
|
+
// The second element of each tuple is the extension that should be used in a path import.
|
|
47572
|
+
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
47573
|
+
var suggestedExtensions = [
|
|
47574
|
+
[".mts", ".mjs"],
|
|
47575
|
+
[".ts", ".js"],
|
|
47576
|
+
[".cts", ".cjs"],
|
|
47577
|
+
[".mjs", ".mjs"],
|
|
47578
|
+
[".js", ".js"],
|
|
47579
|
+
[".cjs", ".cjs"],
|
|
47580
|
+
[".tsx", compilerOptions.jsx === 1 /* Preserve */ ? ".jsx" : ".js"],
|
|
47581
|
+
[".jsx", ".jsx"],
|
|
47582
|
+
[".json", ".json"],
|
|
47583
|
+
];
|
|
47565
47584
|
initializeTypeChecker();
|
|
47566
47585
|
return checker;
|
|
47567
47586
|
function getJsxNamespace(location) {
|
|
@@ -49777,7 +49796,7 @@ var ts;
|
|
|
49777
49796
|
: undefined;
|
|
49778
49797
|
}
|
|
49779
49798
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49780
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49799
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49781
49800
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49782
49801
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49783
49802
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49798,7 +49817,7 @@ var ts;
|
|
|
49798
49817
|
((_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) ||
|
|
49799
49818
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49800
49819
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49801
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49820
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49802
49821
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49803
49822
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49804
49823
|
if (sourceFile) {
|
|
@@ -49864,6 +49883,10 @@ var ts;
|
|
|
49864
49883
|
}
|
|
49865
49884
|
else {
|
|
49866
49885
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
49886
|
+
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
49887
|
+
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
49888
|
+
var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
|
|
49889
|
+
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
49867
49890
|
if (tsExtension) {
|
|
49868
49891
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49869
49892
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49883,6 +49906,19 @@ var ts;
|
|
|
49883
49906
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49884
49907
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49885
49908
|
}
|
|
49909
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
|
|
49910
|
+
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
49911
|
+
var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
|
|
49912
|
+
var actualExt = _a[0], _importExt = _a[1];
|
|
49913
|
+
return host.fileExists(absoluteRef_1 + actualExt);
|
|
49914
|
+
})) === null || _g === void 0 ? void 0 : _g[1];
|
|
49915
|
+
if (suggestedExt) {
|
|
49916
|
+
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);
|
|
49917
|
+
}
|
|
49918
|
+
else {
|
|
49919
|
+
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);
|
|
49920
|
+
}
|
|
49921
|
+
}
|
|
49886
49922
|
else {
|
|
49887
49923
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49888
49924
|
}
|
|
@@ -61795,7 +61831,8 @@ var ts;
|
|
|
61795
61831
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61796
61832
|
if (!type.declaration.nameType) {
|
|
61797
61833
|
var constraint = void 0;
|
|
61798
|
-
if (isArrayType(t) ||
|
|
61834
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
61835
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61799
61836
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61800
61837
|
}
|
|
61801
61838
|
if (isGenericTupleType(t)) {
|
|
@@ -95098,11 +95135,11 @@ var ts;
|
|
|
95098
95135
|
currentFileState.filenameDeclaration = declaration;
|
|
95099
95136
|
return currentFileState.filenameDeclaration.name;
|
|
95100
95137
|
}
|
|
95101
|
-
function getJsxFactoryCalleePrimitive(
|
|
95102
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
95138
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
95139
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
95103
95140
|
}
|
|
95104
|
-
function getJsxFactoryCallee(
|
|
95105
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
95141
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
95142
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
95106
95143
|
return getImplicitImportForName(type);
|
|
95107
95144
|
}
|
|
95108
95145
|
function getImplicitJsxFragmentReference() {
|
|
@@ -95254,7 +95291,7 @@ var ts;
|
|
|
95254
95291
|
}
|
|
95255
95292
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95256
95293
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95257
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95294
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95258
95295
|
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95259
95296
|
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95260
95297
|
}
|
|
@@ -95268,15 +95305,18 @@ var ts;
|
|
|
95268
95305
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
95269
95306
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
95270
95307
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
95271
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95308
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
95272
95309
|
}
|
|
95273
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95310
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95311
|
+
var _a;
|
|
95312
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95313
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95274
95314
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
95275
95315
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95276
95316
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95277
95317
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95278
95318
|
// isStaticChildren development flag
|
|
95279
|
-
args.push(
|
|
95319
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95280
95320
|
// __source development flag
|
|
95281
95321
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
95282
95322
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -95288,7 +95328,7 @@ var ts;
|
|
|
95288
95328
|
args.push(factory.createThis());
|
|
95289
95329
|
}
|
|
95290
95330
|
}
|
|
95291
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95331
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
95292
95332
|
if (isChild) {
|
|
95293
95333
|
ts.startOnNewLine(element);
|
|
95294
95334
|
}
|
|
@@ -95318,7 +95358,7 @@ var ts;
|
|
|
95318
95358
|
}
|
|
95319
95359
|
}
|
|
95320
95360
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
95321
|
-
/*keyAttr*/ undefined,
|
|
95361
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
95322
95362
|
}
|
|
95323
95363
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
95324
95364
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -114394,8 +114434,8 @@ var ts;
|
|
|
114394
114434
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114395
114435
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114396
114436
|
// ensure that types resolutions are still correct
|
|
114397
|
-
var
|
|
114398
|
-
if (
|
|
114437
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114438
|
+
if (typeReferenceResolutionsChanged) {
|
|
114399
114439
|
structureIsReused = 1 /* SafeModules */;
|
|
114400
114440
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114401
114441
|
}
|
|
@@ -115683,6 +115723,21 @@ var ts;
|
|
|
115683
115723
|
return resolvedRef;
|
|
115684
115724
|
}
|
|
115685
115725
|
function verifyCompilerOptions() {
|
|
115726
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115727
|
+
if (!isNightly) {
|
|
115728
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115729
|
+
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");
|
|
115730
|
+
}
|
|
115731
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115732
|
+
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");
|
|
115733
|
+
}
|
|
115734
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115735
|
+
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");
|
|
115736
|
+
}
|
|
115737
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115738
|
+
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");
|
|
115739
|
+
}
|
|
115740
|
+
}
|
|
115686
115741
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115687
115742
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115688
115743
|
}
|
|
@@ -116161,8 +116216,8 @@ var ts;
|
|
|
116161
116216
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
116162
116217
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
116163
116218
|
}
|
|
116164
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
116165
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116219
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116220
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
116166
116221
|
}
|
|
116167
116222
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
116168
116223
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118406,6 +118461,9 @@ var ts;
|
|
|
118406
118461
|
else {
|
|
118407
118462
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118408
118463
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118464
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118465
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118466
|
+
}
|
|
118409
118467
|
}
|
|
118410
118468
|
resolutionsInFile.set(name, mode, resolution);
|
|
118411
118469
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118874,6 +118932,11 @@ var ts;
|
|
|
118874
118932
|
}
|
|
118875
118933
|
}
|
|
118876
118934
|
ts.createResolutionCache = createResolutionCache;
|
|
118935
|
+
function resolutionIsSymlink(resolution) {
|
|
118936
|
+
var _a, _b;
|
|
118937
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118938
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118939
|
+
}
|
|
118877
118940
|
})(ts || (ts = {}));
|
|
118878
118941
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118879
118942
|
/* @internal */
|
|
@@ -126320,6 +126383,12 @@ var ts;
|
|
|
126320
126383
|
return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
|
|
126321
126384
|
}
|
|
126322
126385
|
ts.getNewLineKind = getNewLineKind;
|
|
126386
|
+
function diagnosticToString(diag) {
|
|
126387
|
+
return ts.isArray(diag)
|
|
126388
|
+
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
126389
|
+
: ts.getLocaleSpecificMessage(diag);
|
|
126390
|
+
}
|
|
126391
|
+
ts.diagnosticToString = diagnosticToString;
|
|
126323
126392
|
// #endregion
|
|
126324
126393
|
})(ts || (ts = {}));
|
|
126325
126394
|
/*@internal*/
|
|
@@ -128666,6 +128735,8 @@ var ts;
|
|
|
128666
128735
|
(function (CompletionSource) {
|
|
128667
128736
|
/** Completions that require `this.` insertion text */
|
|
128668
128737
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128738
|
+
/** Auto-import that comes attached to a class member snippet */
|
|
128739
|
+
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
128669
128740
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
128670
128741
|
var SymbolOriginInfoKind;
|
|
128671
128742
|
(function (SymbolOriginInfoKind) {
|
|
@@ -129028,6 +129099,7 @@ var ts;
|
|
|
129028
129099
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
129029
129100
|
var data;
|
|
129030
129101
|
var isSnippet;
|
|
129102
|
+
var source = getSourceFromOrigin(origin);
|
|
129031
129103
|
var sourceDisplay;
|
|
129032
129104
|
var hasAction;
|
|
129033
129105
|
var typeChecker = program.getTypeChecker();
|
|
@@ -129085,7 +129157,12 @@ var ts;
|
|
|
129085
129157
|
preferences.includeCompletionsWithInsertText &&
|
|
129086
129158
|
completionKind === 3 /* MemberLike */ &&
|
|
129087
129159
|
isClassLikeMemberCompletion(symbol, location)) {
|
|
129088
|
-
|
|
129160
|
+
var importAdder = void 0;
|
|
129161
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
129162
|
+
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
129163
|
+
hasAction = true;
|
|
129164
|
+
source = CompletionSource.ClassMemberSnippet;
|
|
129165
|
+
}
|
|
129089
129166
|
}
|
|
129090
129167
|
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
|
|
129091
129168
|
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
@@ -129132,7 +129209,7 @@ var ts;
|
|
|
129132
129209
|
kind: kind,
|
|
129133
129210
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
129134
129211
|
sortText: sortText,
|
|
129135
|
-
source:
|
|
129212
|
+
source: source,
|
|
129136
129213
|
hasAction: hasAction ? true : undefined,
|
|
129137
129214
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
|
|
129138
129215
|
insertText: insertText,
|
|
@@ -129201,15 +129278,14 @@ var ts;
|
|
|
129201
129278
|
});
|
|
129202
129279
|
var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
|
|
129203
129280
|
var body;
|
|
129204
|
-
var tabstopStart = 1;
|
|
129205
129281
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
129206
129282
|
isSnippet = true;
|
|
129207
|
-
// We are adding a
|
|
129283
|
+
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
|
|
129284
|
+
// if it has one, so that the cursor ends up in the body once the completion is inserted.
|
|
129208
129285
|
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
|
|
129209
|
-
var
|
|
129210
|
-
ts.setSnippetElement(
|
|
129211
|
-
|
|
129212
|
-
body = ts.factory.createBlock([emptyStatement1], /* multiline */ true);
|
|
129286
|
+
var emptyStatement = ts.factory.createExpressionStatement(ts.factory.createIdentifier(""));
|
|
129287
|
+
ts.setSnippetElement(emptyStatement, { kind: 0 /* TabStop */, order: 0 });
|
|
129288
|
+
body = ts.factory.createBlock([emptyStatement], /* multiline */ true);
|
|
129213
129289
|
}
|
|
129214
129290
|
else {
|
|
129215
129291
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
@@ -129255,12 +129331,9 @@ var ts;
|
|
|
129255
129331
|
completionNodes.push(node);
|
|
129256
129332
|
}, body, isAbstract);
|
|
129257
129333
|
if (completionNodes.length) {
|
|
129258
|
-
if (preferences.includeCompletionsWithSnippetText) {
|
|
129259
|
-
addSnippets(completionNodes, tabstopStart);
|
|
129260
|
-
}
|
|
129261
129334
|
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
129262
129335
|
}
|
|
129263
|
-
return { insertText: insertText, isSnippet: isSnippet };
|
|
129336
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
129264
129337
|
}
|
|
129265
129338
|
function getPresentModifiers(contextToken) {
|
|
129266
129339
|
var modifiers = 0 /* None */;
|
|
@@ -129301,33 +129374,6 @@ var ts;
|
|
|
129301
129374
|
}
|
|
129302
129375
|
return undefined;
|
|
129303
129376
|
}
|
|
129304
|
-
function addSnippets(nodes, orderStart) {
|
|
129305
|
-
var order = orderStart;
|
|
129306
|
-
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
129307
|
-
var node = nodes_1[_i];
|
|
129308
|
-
addSnippetsWorker(node, /*parent*/ undefined);
|
|
129309
|
-
}
|
|
129310
|
-
function addSnippetsWorker(node, parent) {
|
|
129311
|
-
if (ts.isVariableLike(node) && node.kind === 163 /* Parameter */) {
|
|
129312
|
-
// Placeholder
|
|
129313
|
-
ts.setSnippetElement(node.name, { kind: 1 /* Placeholder */, order: order });
|
|
129314
|
-
order += 1;
|
|
129315
|
-
if (node.type) {
|
|
129316
|
-
ts.setSnippetElement(node.type, { kind: 1 /* Placeholder */, order: order });
|
|
129317
|
-
order += 1;
|
|
129318
|
-
}
|
|
129319
|
-
}
|
|
129320
|
-
else if (ts.isTypeNode(node) && parent && ts.isFunctionLikeDeclaration(parent)) {
|
|
129321
|
-
ts.setSnippetElement(node, { kind: 1 /* Placeholder */, order: order });
|
|
129322
|
-
order += 1;
|
|
129323
|
-
}
|
|
129324
|
-
else if (ts.isTypeParameterDeclaration(node) && parent && ts.isFunctionLikeDeclaration(parent)) {
|
|
129325
|
-
ts.setSnippetElement(node, { kind: 1 /* Placeholder */, order: order });
|
|
129326
|
-
order += 1;
|
|
129327
|
-
}
|
|
129328
|
-
ts.forEachChild(node, function (child) { return addSnippetsWorker(child, node); });
|
|
129329
|
-
}
|
|
129330
|
-
}
|
|
129331
129377
|
function createSnippetPrinter(printerOptions) {
|
|
129332
129378
|
var printer = ts.createPrinter(printerOptions);
|
|
129333
129379
|
var baseWriter = ts.createTextWriter(ts.getNewLineCharacter(printerOptions));
|
|
@@ -129549,11 +129595,13 @@ var ts;
|
|
|
129549
129595
|
if (entryId.data) {
|
|
129550
129596
|
var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
129551
129597
|
if (autoImport) {
|
|
129598
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
|
|
129552
129599
|
return {
|
|
129553
129600
|
type: "symbol",
|
|
129554
129601
|
symbol: autoImport.symbol,
|
|
129555
129602
|
location: ts.getTouchingPropertyName(sourceFile, position),
|
|
129556
|
-
previousToken:
|
|
129603
|
+
previousToken: previousToken_1,
|
|
129604
|
+
contextToken: contextToken_1,
|
|
129557
129605
|
isJsxInitializer: false,
|
|
129558
129606
|
isTypeOnlyLocation: false,
|
|
129559
129607
|
origin: autoImport.origin,
|
|
@@ -129568,7 +129616,7 @@ var ts;
|
|
|
129568
129616
|
if (completionData.kind !== 0 /* Data */) {
|
|
129569
129617
|
return { type: "request", request: completionData };
|
|
129570
129618
|
}
|
|
129571
|
-
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;
|
|
129619
|
+
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;
|
|
129572
129620
|
var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
|
|
129573
129621
|
if (literal !== undefined)
|
|
129574
129622
|
return { type: "literal", literal: literal };
|
|
@@ -129579,15 +129627,15 @@ var ts;
|
|
|
129579
129627
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
129580
129628
|
var origin = symbolToOriginInfoMap[index];
|
|
129581
129629
|
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
129582
|
-
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
129583
|
-
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129630
|
+
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 /* ClassMember */ || getSourceFromOrigin(origin) === entryId.source)
|
|
129631
|
+
? { type: "symbol", symbol: symbol, location: location, origin: origin, contextToken: contextToken, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129584
129632
|
: undefined;
|
|
129585
129633
|
}) || { type: "none" };
|
|
129586
129634
|
}
|
|
129587
129635
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
129588
129636
|
var typeChecker = program.getTypeChecker();
|
|
129589
129637
|
var compilerOptions = program.getCompilerOptions();
|
|
129590
|
-
var name = entryId.name;
|
|
129638
|
+
var name = entryId.name, source = entryId.source, data = entryId.data;
|
|
129591
129639
|
var contextToken = ts.findPrecedingToken(position, sourceFile);
|
|
129592
129640
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
129593
129641
|
return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
@@ -129611,8 +129659,8 @@ var ts;
|
|
|
129611
129659
|
}
|
|
129612
129660
|
}
|
|
129613
129661
|
case "symbol": {
|
|
129614
|
-
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129615
|
-
var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences,
|
|
129662
|
+
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129663
|
+
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;
|
|
129616
129664
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
|
|
129617
129665
|
}
|
|
129618
129666
|
case "literal": {
|
|
@@ -129641,14 +129689,27 @@ var ts;
|
|
|
129641
129689
|
return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
|
|
129642
129690
|
}
|
|
129643
129691
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
129644
|
-
function getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data) {
|
|
129692
|
+
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
|
|
129645
129693
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
129646
|
-
var _a = getRelevantTokens(position, sourceFile),
|
|
129647
|
-
if (
|
|
129694
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
|
|
129695
|
+
if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
|
|
129648
129696
|
// Import statement completion: 'import c|'
|
|
129649
129697
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
129650
129698
|
}
|
|
129651
129699
|
}
|
|
129700
|
+
if (source === CompletionSource.ClassMemberSnippet) {
|
|
129701
|
+
var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken).importAdder;
|
|
129702
|
+
if (importAdder) {
|
|
129703
|
+
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
129704
|
+
return {
|
|
129705
|
+
sourceDisplay: undefined,
|
|
129706
|
+
codeActions: [{
|
|
129707
|
+
changes: changes,
|
|
129708
|
+
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
129709
|
+
}],
|
|
129710
|
+
};
|
|
129711
|
+
}
|
|
129712
|
+
}
|
|
129652
129713
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
129653
129714
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
129654
129715
|
}
|
|
@@ -144848,8 +144909,8 @@ var ts;
|
|
|
144848
144909
|
ChangeTracker.prototype.deleteNodes = function (sourceFile, nodes, options, hasTrailingComment) {
|
|
144849
144910
|
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
|
|
144850
144911
|
// When deleting multiple nodes we need to track if the end position is including multiline trailing comments.
|
|
144851
|
-
for (var _i = 0,
|
|
144852
|
-
var node =
|
|
144912
|
+
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
144913
|
+
var node = nodes_1[_i];
|
|
144853
144914
|
var pos = getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment);
|
|
144854
144915
|
var end = getAdjustedEndPosition(sourceFile, node, options);
|
|
144855
144916
|
this.deleteRange(sourceFile, { pos: pos, end: end });
|
|
@@ -145954,21 +146015,16 @@ var ts;
|
|
|
145954
146015
|
(function (codefix) {
|
|
145955
146016
|
var errorCodeToFixes = ts.createMultiMap();
|
|
145956
146017
|
var fixIdToRegistration = new ts.Map();
|
|
145957
|
-
function diagnosticToString(diag) {
|
|
145958
|
-
return ts.isArray(diag)
|
|
145959
|
-
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
145960
|
-
: ts.getLocaleSpecificMessage(diag);
|
|
145961
|
-
}
|
|
145962
146018
|
function createCodeFixActionWithoutFixAll(fixName, changes, description) {
|
|
145963
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
146019
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145964
146020
|
}
|
|
145965
146021
|
codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
|
|
145966
146022
|
function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145967
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
|
|
146023
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
|
|
145968
146024
|
}
|
|
145969
146025
|
codefix.createCodeFixAction = createCodeFixAction;
|
|
145970
146026
|
function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145971
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
146027
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, fixAllDescription && ts.diagnosticToString(fixAllDescription), command);
|
|
145972
146028
|
}
|
|
145973
146029
|
codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
|
|
145974
146030
|
function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
|
|
@@ -148729,7 +148785,7 @@ var ts;
|
|
|
148729
148785
|
var addToExisting = new ts.Map();
|
|
148730
148786
|
/** Use `getNewImportEntry` for access */
|
|
148731
148787
|
var newImports = new ts.Map();
|
|
148732
|
-
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
|
|
148788
|
+
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
148733
148789
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
148734
148790
|
var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
148735
148791
|
if (!info || !info.fixes.length)
|
|
@@ -148880,6 +148936,9 @@ var ts;
|
|
|
148880
148936
|
ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
|
|
148881
148937
|
}
|
|
148882
148938
|
}
|
|
148939
|
+
function hasFixes() {
|
|
148940
|
+
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
|
|
148941
|
+
}
|
|
148883
148942
|
}
|
|
148884
148943
|
// Sorted with the preferred fix coming first.
|
|
148885
148944
|
var ImportFixKind;
|
|
@@ -159401,8 +159460,8 @@ var ts;
|
|
|
159401
159460
|
var list = createNode(346 /* SyntaxList */, nodes.pos, nodes.end, parent);
|
|
159402
159461
|
list._children = [];
|
|
159403
159462
|
var pos = nodes.pos;
|
|
159404
|
-
for (var _i = 0,
|
|
159405
|
-
var node =
|
|
159463
|
+
for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
|
|
159464
|
+
var node = nodes_2[_i];
|
|
159406
159465
|
addSyntheticNodes(list._children, pos, node.pos, parent);
|
|
159407
159466
|
list._children.push(node);
|
|
159408
159467
|
pos = node.end;
|