typescript 4.5.0-dev.20211026 → 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/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.20211026";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211030";
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 tranditional cjs resolution
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); // TODO: GH#18217
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
- if (ts.getESModuleInterop(compilerOptions)) {
49707
- var referenceParent = referencingLocation.parent;
49708
- if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
49709
- ts.isImportCall(referenceParent)) {
49710
- var type = getTypeOfSymbol(symbol);
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, ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier);
49717
- // Create a new symbol which has the module's type less the call and construct signatures
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
  }
@@ -59342,7 +59443,7 @@ var ts;
59342
59443
  var _loop_16 = function () {
59343
59444
  i--;
59344
59445
  var t = types[i];
59345
- if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeSubtypeOf(t, template); })) {
59446
+ if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
59346
59447
  ts.orderedRemoveItemAt(types, i);
59347
59448
  }
59348
59449
  };
@@ -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
- if (isArrayType(t)) {
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)) {
@@ -63075,13 +63178,12 @@ var ts;
63075
63178
  traceUnionsOrIntersectionsTooLarge(source, target);
63076
63179
  var result = 0 /* False */;
63077
63180
  var saveErrorInfo = captureErrorCalculationState();
63078
- // Note that these checks are specifically ordered to produce correct results. In particular,
63079
- // we need to deconstruct unions before intersections (because unions are always at the top),
63080
- // and we need to handle "each" relations before "some" relations for the same kind of type.
63081
- if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63082
- result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
63083
- recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags) :
63084
- structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63181
+ if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
63182
+ // We skip caching when source or target is a union with no more than three constituents.
63183
+ result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63184
+ }
63185
+ else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63186
+ result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
63085
63187
  }
63086
63188
  if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
63087
63189
  if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
@@ -63538,19 +63640,19 @@ var ts;
63538
63640
  var maybeStart = maybeCount;
63539
63641
  maybeKeys[maybeCount] = id;
63540
63642
  maybeCount++;
63643
+ var saveExpandingFlags = expandingFlags;
63541
63644
  if (recursionFlags & 1 /* Source */) {
63542
63645
  sourceStack[sourceDepth] = source;
63543
63646
  sourceDepth++;
63647
+ if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63648
+ expandingFlags |= 1 /* Source */;
63544
63649
  }
63545
63650
  if (recursionFlags & 2 /* Target */) {
63546
63651
  targetStack[targetDepth] = target;
63547
63652
  targetDepth++;
63653
+ if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63654
+ expandingFlags |= 2 /* Target */;
63548
63655
  }
63549
- var saveExpandingFlags = expandingFlags;
63550
- if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63551
- expandingFlags |= 1 /* Source */;
63552
- if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63553
- expandingFlags |= 2 /* Target */;
63554
63656
  var originalHandler;
63555
63657
  var propagatingVarianceFlags = 0;
63556
63658
  if (outofbandVarianceMarkerHandler) {
@@ -63574,13 +63676,13 @@ var ts;
63574
63676
  if (outofbandVarianceMarkerHandler) {
63575
63677
  outofbandVarianceMarkerHandler = originalHandler;
63576
63678
  }
63577
- expandingFlags = saveExpandingFlags;
63578
63679
  if (recursionFlags & 1 /* Source */) {
63579
63680
  sourceDepth--;
63580
63681
  }
63581
63682
  if (recursionFlags & 2 /* Target */) {
63582
63683
  targetDepth--;
63583
63684
  }
63685
+ expandingFlags = saveExpandingFlags;
63584
63686
  if (result) {
63585
63687
  if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
63586
63688
  if (result === -1 /* True */ || result === 3 /* Maybe */) {
@@ -63918,8 +64020,7 @@ var ts;
63918
64020
  // For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
63919
64021
  instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
63920
64022
  }
63921
- var result_9 = inferTypesFromTemplateLiteralType(source, target);
63922
- if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
64023
+ if (isTypeMatchedByTemplateLiteralType(source, target)) {
63923
64024
  return -1 /* True */;
63924
64025
  }
63925
64026
  }
@@ -64114,9 +64215,9 @@ var ts;
64114
64215
  if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
64115
64216
  var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
64116
64217
  if (objectOnlyTarget.flags & 1048576 /* Union */) {
64117
- var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64118
- if (result_10) {
64119
- return result_10;
64218
+ var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64219
+ if (result_9) {
64220
+ return result_9;
64120
64221
  }
64121
64222
  }
64122
64223
  }
@@ -64188,13 +64289,13 @@ var ts;
64188
64289
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
64189
64290
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
64190
64291
  if (modifiersRelated) {
64191
- var result_11;
64292
+ var result_10;
64192
64293
  var targetConstraint = getConstraintTypeFromMappedType(target);
64193
64294
  var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
64194
- if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64295
+ if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64195
64296
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
64196
64297
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
64197
- return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64298
+ return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64198
64299
  }
64199
64300
  }
64200
64301
  }
@@ -66277,6 +66378,10 @@ var ts;
66277
66378
  inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
66278
66379
  undefined;
66279
66380
  }
66381
+ function isTypeMatchedByTemplateLiteralType(source, target) {
66382
+ var inferences = inferTypesFromTemplateLiteralType(source, target);
66383
+ return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
66384
+ }
66280
66385
  function getStringLikeTypeForType(type) {
66281
66386
  return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
66282
66387
  }
@@ -67180,8 +67285,11 @@ var ts;
67180
67285
  function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
67181
67286
  switch (node.kind) {
67182
67287
  case 79 /* Identifier */:
67183
- var symbol = getResolvedSymbol(node);
67184
- return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
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
67185
67293
  case 108 /* ThisKeyword */:
67186
67294
  return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
67187
67295
  case 229 /* NonNullExpression */:
@@ -67812,7 +67920,7 @@ var ts;
67812
67920
  mapType(type, mapper);
67813
67921
  }
67814
67922
  function getConstituentCount(type) {
67815
- return type.flags & 3145728 /* UnionOrIntersection */ ? type.types.length : 1;
67923
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
67816
67924
  }
67817
67925
  function extractTypesOfKind(type, kind) {
67818
67926
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -69310,7 +69418,7 @@ var ts;
69310
69418
  return parent.kind === 205 /* PropertyAccessExpression */ ||
69311
69419
  parent.kind === 207 /* CallExpression */ && parent.expression === node ||
69312
69420
  parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
69313
- !(isGenericTypeWithoutNullableConstraint(type) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69421
+ !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69314
69422
  }
69315
69423
  function isGenericTypeWithUnionConstraint(type) {
69316
69424
  return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
@@ -74910,11 +75018,33 @@ var ts;
74910
75018
  if (moduleSymbol) {
74911
75019
  var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
74912
75020
  if (esModuleSymbol) {
74913
- return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
75021
+ return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
75022
+ getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
74914
75023
  }
74915
75024
  }
74916
75025
  return createPromiseReturnType(node, anyType);
74917
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
+ }
74918
75048
  function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
74919
75049
  var _a;
74920
75050
  if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
@@ -74923,14 +75053,8 @@ var ts;
74923
75053
  var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
74924
75054
  var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
74925
75055
  if (hasSyntheticDefault) {
74926
- var memberTable = ts.createSymbolTable();
74927
- var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
74928
- newSymbol.parent = originalSymbol;
74929
- newSymbol.nameType = getStringLiteralType("default");
74930
- newSymbol.target = resolveSymbol(symbol);
74931
- memberTable.set("default" /* Default */, newSymbol);
74932
75056
  var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
74933
- var defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
75057
+ var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
74934
75058
  anonymousSymbol.type = defaultContainingObject;
74935
75059
  synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
74936
75060
  }
@@ -75638,12 +75762,12 @@ var ts;
75638
75762
  var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
75639
75763
  // notEqualFacts states that the type of the switched value is not equal to every type in the switch.
75640
75764
  var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
75641
- var type_4 = getBaseConstraintOfType(operandType) || operandType;
75765
+ var type_5 = getBaseConstraintOfType(operandType) || operandType;
75642
75766
  // Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
75643
- if (type_4.flags & 3 /* AnyOrUnknown */) {
75767
+ if (type_5.flags & 3 /* AnyOrUnknown */) {
75644
75768
  return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
75645
75769
  }
75646
- return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
75770
+ return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
75647
75771
  }
75648
75772
  var type = getTypeOfExpression(node.expression);
75649
75773
  if (!isLiteralType(type)) {
@@ -78739,12 +78863,12 @@ var ts;
78739
78863
  case 264 /* ImportEqualsDeclaration */:
78740
78864
  case 267 /* NamespaceImport */:
78741
78865
  case 266 /* ImportClause */:
78742
- var result_12 = 0 /* None */;
78866
+ var result_11 = 0 /* None */;
78743
78867
  var target = resolveAlias(getSymbolOfNode(d));
78744
78868
  ts.forEach(target.declarations, function (d) {
78745
- result_12 |= getDeclarationSpaces(d);
78869
+ result_11 |= getDeclarationSpaces(d);
78746
78870
  });
78747
- return result_12;
78871
+ return result_11;
78748
78872
  case 253 /* VariableDeclaration */:
78749
78873
  case 202 /* BindingElement */:
78750
78874
  case 255 /* FunctionDeclaration */:
@@ -81613,7 +81737,7 @@ var ts;
81613
81737
  checkKindsOfPropertyMemberOverrides(type, baseType_1);
81614
81738
  }
81615
81739
  }
81616
- checkMembersForMissingOverrideModifier(node, type, typeWithThis, staticType);
81740
+ checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
81617
81741
  var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
81618
81742
  if (implementedTypeNodes) {
81619
81743
  for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
@@ -81648,8 +81772,7 @@ var ts;
81648
81772
  checkPropertyInitialization(node);
81649
81773
  }
81650
81774
  }
81651
- function checkMembersForMissingOverrideModifier(node, type, typeWithThis, staticType) {
81652
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
81775
+ function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
81653
81776
  var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
81654
81777
  var baseTypes = baseTypeNode && getBaseTypes(type);
81655
81778
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
@@ -81661,46 +81784,71 @@ var ts;
81661
81784
  if (ts.isConstructorDeclaration(member)) {
81662
81785
  ts.forEach(member.parameters, function (param) {
81663
81786
  if (ts.isParameterPropertyDeclaration(param, member)) {
81664
- checkClassMember(param, /*memberIsParameterProperty*/ true);
81787
+ checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
81788
+ /* memberIsParameterProperty */ true);
81665
81789
  }
81666
81790
  });
81667
81791
  }
81668
- checkClassMember(member);
81792
+ checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
81793
+ /* memberIsParameterProperty */ false);
81669
81794
  };
81670
81795
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
81671
81796
  var member = _a[_i];
81672
81797
  _loop_29(member);
81673
81798
  }
81674
- function checkClassMember(member, memberIsParameterProperty) {
81675
- var hasOverride = ts.hasOverrideModifier(member);
81676
- var hasStatic = ts.isStatic(member);
81677
- var isJs = ts.isInJSFile(member);
81678
- if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
81679
- var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
81680
- if (!declaredProp) {
81681
- return;
81682
- }
81683
- var thisType = hasStatic ? staticType : typeWithThis;
81684
- var baseType = hasStatic ? baseStaticType : baseWithThis;
81685
- var prop = getPropertyOfType(thisType, declaredProp.escapedName);
81686
- var baseProp = getPropertyOfType(baseType, declaredProp.escapedName);
81687
- var baseClassName = typeToString(baseWithThis);
81688
- if (prop && !baseProp && hasOverride) {
81689
- var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
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`
81690
81835
  suggestion ?
81691
- error(member, isJs ?
81836
+ error(errorNode, isJs ?
81692
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 :
81693
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)) :
81694
- error(member, isJs ?
81839
+ error(errorNode, isJs ?
81695
81840
  ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
81696
81841
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
81697
81842
  }
81698
- else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
81699
- var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
81700
- if (hasOverride) {
81701
- return;
81702
- }
81703
- if (!baseHasAbstract) {
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) {
81704
81852
  var diag = memberIsParameterProperty ?
81705
81853
  isJs ?
81706
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 :
@@ -81708,20 +81856,28 @@ var ts;
81708
81856
  isJs ?
81709
81857
  ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
81710
81858
  ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
81711
- error(member, diag, baseClassName);
81859
+ error(errorNode, diag, baseClassName);
81712
81860
  }
81713
- else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
81714
- error(member, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
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);
81715
81866
  }
81867
+ return 1 /* NeedsOverride */;
81716
81868
  }
81717
81869
  }
81718
- else if (hasOverride) {
81870
+ }
81871
+ else if (memberHasOverrideModifier) {
81872
+ if (errorNode) {
81719
81873
  var className = typeToString(type);
81720
- error(member, isJs ?
81874
+ error(errorNode, isJs ?
81721
81875
  ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
81722
81876
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
81723
81877
  }
81878
+ return 2 /* HasInvalidOverride */;
81724
81879
  }
81880
+ return 0 /* Ok */;
81725
81881
  }
81726
81882
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
81727
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
@@ -81764,6 +81920,31 @@ var ts;
81764
81920
  }
81765
81921
  }
81766
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
+ }
81767
81948
  function getTargetSymbol(s) {
81768
81949
  // if symbol is instantiated its flags are not copied from the 'target'
81769
81950
  // so we'll need to get back original 'target' symbol to work with correct set of flags
@@ -94760,11 +94941,11 @@ var ts;
94760
94941
  currentFileState.filenameDeclaration = declaration;
94761
94942
  return currentFileState.filenameDeclaration.name;
94762
94943
  }
94763
- function getJsxFactoryCalleePrimitive(childrenLength) {
94764
- return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : childrenLength > 1 ? "jsxs" : "jsx";
94944
+ function getJsxFactoryCalleePrimitive(isStaticChildren) {
94945
+ return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
94765
94946
  }
94766
- function getJsxFactoryCallee(childrenLength) {
94767
- var type = getJsxFactoryCalleePrimitive(childrenLength);
94947
+ function getJsxFactoryCallee(isStaticChildren) {
94948
+ var type = getJsxFactoryCalleePrimitive(isStaticChildren);
94768
94949
  return getImplicitImportForName(type);
94769
94950
  }
94770
94951
  function getImplicitJsxFragmentReference() {
@@ -94916,9 +95097,9 @@ var ts;
94916
95097
  }
94917
95098
  function convertJsxChildrenToChildrenPropAssignment(children) {
94918
95099
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
94919
- if (ts.length(nonWhitespaceChildren) === 1) {
94920
- var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
94921
- return result_13 && factory.createPropertyAssignment("children", result_13);
95100
+ if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
95101
+ var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95102
+ return result_12 && factory.createPropertyAssignment("children", result_12);
94922
95103
  }
94923
95104
  var result = ts.mapDefined(children, transformJsxChildToExpression);
94924
95105
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -94930,15 +95111,18 @@ var ts;
94930
95111
  var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
94931
95112
  var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
94932
95113
  factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
94933
- return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, ts.length(ts.getSemanticJsxChildren(children || ts.emptyArray)), isChild, location);
95114
+ return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
94934
95115
  }
94935
- function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, childrenLength, isChild, location) {
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);
94936
95120
  var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
94937
95121
  if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
94938
95122
  var originalFile = ts.getOriginalNode(currentSourceFile);
94939
95123
  if (originalFile && ts.isSourceFile(originalFile)) {
94940
95124
  // isStaticChildren development flag
94941
- args.push(childrenLength > 1 ? factory.createTrue() : factory.createFalse());
95125
+ args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
94942
95126
  // __source development flag
94943
95127
  var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
94944
95128
  args.push(factory.createObjectLiteralExpression([
@@ -94950,7 +95134,7 @@ var ts;
94950
95134
  args.push(factory.createThis());
94951
95135
  }
94952
95136
  }
94953
- var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(childrenLength), /*typeArguments*/ undefined, args), location);
95137
+ var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
94954
95138
  if (isChild) {
94955
95139
  ts.startOnNewLine(element);
94956
95140
  }
@@ -94980,7 +95164,7 @@ var ts;
94980
95164
  }
94981
95165
  }
94982
95166
  return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
94983
- /*keyAttr*/ undefined, ts.length(ts.getSemanticJsxChildren(children)), isChild, location);
95167
+ /*keyAttr*/ undefined, children, isChild, location);
94984
95168
  }
94985
95169
  function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
94986
95170
  var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
@@ -108068,7 +108252,14 @@ var ts;
108068
108252
  // clear the parenthesizer rule as we ascend
108069
108253
  currentParenthesizerRule = undefined;
108070
108254
  }
108071
- 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
+ }
108072
108263
  if (hint === 0 /* SourceFile */)
108073
108264
  return emitSourceFile(ts.cast(node, ts.isSourceFile));
108074
108265
  if (hint === 2 /* IdentifierName */)
@@ -108677,6 +108868,28 @@ var ts;
108677
108868
  }
108678
108869
  }
108679
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
+ //
108680
108893
  // Identifiers
108681
108894
  //
108682
108895
  function emitIdentifier(node) {
@@ -110915,6 +111128,15 @@ var ts;
110915
111128
  function writeProperty(s) {
110916
111129
  writer.writeProperty(s);
110917
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
+ }
110918
111140
  function writeLine(count) {
110919
111141
  if (count === void 0) { count = 1; }
110920
111142
  for (var i = 0; i < count; i++) {
@@ -113718,15 +113940,15 @@ var ts;
113718
113940
  // which per above occurred during the current program creation.
113719
113941
  // Since we assume the filesystem does not change during program creation,
113720
113942
  // it is safe to reuse resolutions from the earlier call.
113721
- var result_14 = [];
113943
+ var result_13 = [];
113722
113944
  var i = 0;
113723
113945
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
113724
113946
  var moduleName = moduleNames_1[_i];
113725
113947
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
113726
113948
  i++;
113727
- result_14.push(resolvedModule);
113949
+ result_13.push(resolvedModule);
113728
113950
  }
113729
- return result_14;
113951
+ return result_13;
113730
113952
  }
113731
113953
  // At this point, we know at least one of the following hold:
113732
113954
  // - file has local declarations for ambient modules
@@ -114018,8 +114240,8 @@ var ts;
114018
114240
  var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
114019
114241
  var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
114020
114242
  // ensure that types resolutions are still correct
114021
- var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
114022
- if (typeReferenceEesolutionsChanged) {
114243
+ var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
114244
+ if (typeReferenceResolutionsChanged) {
114023
114245
  structureIsReused = 1 /* SafeModules */;
114024
114246
  newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
114025
114247
  }
@@ -115307,6 +115529,21 @@ var ts;
115307
115529
  return resolvedRef;
115308
115530
  }
115309
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
+ }
115310
115547
  if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
115311
115548
  createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
115312
115549
  }
@@ -115455,7 +115692,9 @@ var ts;
115455
115692
  }
115456
115693
  }
115457
115694
  if (options.resolveJsonModule) {
115458
- 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) {
115459
115698
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
115460
115699
  }
115461
115700
  // Any emit other than common js, amd, es2015 or esnext is error
@@ -115783,8 +116022,8 @@ var ts;
115783
116022
  function createDiagnosticForOptionName(message, option1, option2, option3) {
115784
116023
  createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
115785
116024
  }
115786
- function createOptionValueDiagnostic(option1, message, arg0) {
115787
- 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);
115788
116027
  }
115789
116028
  function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
115790
116029
  var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
@@ -118028,6 +118267,9 @@ var ts;
118028
118267
  else {
118029
118268
  resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
118030
118269
  perDirectoryResolution.set(name, mode, resolution);
118270
+ if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
118271
+ resolutionHost.onDiscoveredSymlink();
118272
+ }
118031
118273
  }
118032
118274
  resolutionsInFile.set(name, mode, resolution);
118033
118275
  watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
@@ -118496,6 +118738,11 @@ var ts;
118496
118738
  }
118497
118739
  }
118498
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
+ }
118499
118746
  })(ts || (ts = {}));
118500
118747
  // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
118501
118748
  /* @internal */
@@ -118788,9 +119035,9 @@ var ts;
118788
119035
  if (!preferSymlinks) {
118789
119036
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
118790
119037
  // so we only need to remove them from the realpath filenames.
118791
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118792
- if (result_15)
118793
- return result_15;
119038
+ var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
119039
+ if (result_14)
119040
+ return result_14;
118794
119041
  }
118795
119042
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
118796
119043
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -118810,10 +119057,10 @@ var ts;
118810
119057
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
118811
119058
  var symlinkDirectory = symlinkDirectories_1[_i];
118812
119059
  var option = ts.resolvePath(symlinkDirectory, relative);
118813
- var result_16 = cb(option, target === referenceRedirect);
119060
+ var result_15 = cb(option, target === referenceRedirect);
118814
119061
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
118815
- if (result_16)
118816
- return result_16;
119062
+ if (result_15)
119063
+ return result_15;
118817
119064
  }
118818
119065
  });
118819
119066
  });
@@ -125550,6 +125797,16 @@ var ts;
125550
125797
  return decisionFromFile !== null && decisionFromFile !== void 0 ? decisionFromFile : program.usesUriStyleNodeCoreModules;
125551
125798
  }
125552
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;
125553
125810
  // #endregion
125554
125811
  })(ts || (ts = {}));
125555
125812
  /*@internal*/
@@ -127147,7 +127404,7 @@ var ts;
127147
127404
  (function (Completions) {
127148
127405
  var StringCompletions;
127149
127406
  (function (StringCompletions) {
127150
- function getStringLiteralCompletions(sourceFile, position, contextToken, checker, options, host, log, preferences) {
127407
+ function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
127151
127408
  if (ts.isInReferenceComment(sourceFile, position)) {
127152
127409
  var entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
127153
127410
  return entries && convertPathCompletions(entries);
@@ -127155,12 +127412,12 @@ var ts;
127155
127412
  if (ts.isInString(sourceFile, position, contextToken)) {
127156
127413
  if (!contextToken || !ts.isStringLiteralLike(contextToken))
127157
127414
  return undefined;
127158
- var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, checker, options, host, preferences);
127159
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, checker, log, options, preferences);
127415
+ var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
127416
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences);
127160
127417
  }
127161
127418
  }
127162
127419
  StringCompletions.getStringLiteralCompletions = getStringLiteralCompletions;
127163
- function convertStringLiteralCompletions(completion, contextToken, sourceFile, checker, log, options, preferences) {
127420
+ function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences) {
127164
127421
  if (completion === undefined) {
127165
127422
  return undefined;
127166
127423
  }
@@ -127170,7 +127427,7 @@ var ts;
127170
127427
  return convertPathCompletions(completion.paths);
127171
127428
  case 1 /* Properties */: {
127172
127429
  var entries = [];
127173
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile, checker, 99 /* ESNext */, log, 4 /* String */, preferences, options); // Target will not be used, so arbitrary
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
127174
127431
  return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries };
127175
127432
  }
127176
127433
  case 2 /* Types */: {
@@ -127896,6 +128153,8 @@ var ts;
127896
128153
  (function (CompletionSource) {
127897
128154
  /** Completions that require `this.` insertion text */
127898
128155
  CompletionSource["ThisProperty"] = "ThisProperty/";
128156
+ /** Auto-import that comes attached to a class member snippet */
128157
+ CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
127899
128158
  })(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
127900
128159
  var SymbolOriginInfoKind;
127901
128160
  (function (SymbolOriginInfoKind) {
@@ -128004,7 +128263,6 @@ var ts;
128004
128263
  }
128005
128264
  // If the request is a continuation of an earlier `isIncomplete` response,
128006
128265
  // we can continue it from the cached previous response.
128007
- var typeChecker = program.getTypeChecker();
128008
128266
  var compilerOptions = program.getCompilerOptions();
128009
128267
  var incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) === null || _a === void 0 ? void 0 : _a.call(host) : undefined;
128010
128268
  if (incompleteCompletionsCache && completionKind === 3 /* TriggerForIncompleteCompletions */ && previousToken && ts.isIdentifier(previousToken)) {
@@ -128016,7 +128274,7 @@ var ts;
128016
128274
  else {
128017
128275
  incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.clear();
128018
128276
  }
128019
- var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, typeChecker, compilerOptions, host, log, preferences);
128277
+ var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
128020
128278
  if (stringCompletions) {
128021
128279
  return stringCompletions;
128022
128280
  }
@@ -128030,7 +128288,7 @@ var ts;
128030
128288
  }
128031
128289
  switch (completionData.kind) {
128032
128290
  case 0 /* Data */:
128033
- var response = completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences);
128291
+ var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences);
128034
128292
  if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
128035
128293
  incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
128036
128294
  }
@@ -128127,7 +128385,7 @@ var ts;
128127
128385
  // StringLiteralLike locations are handled separately in stringCompletions.ts
128128
128386
  return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
128129
128387
  }
128130
- function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) {
128388
+ function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences) {
128131
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;
128132
128390
  // Verify if the file is JSX language variant
128133
128391
  if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
@@ -128139,7 +128397,7 @@ var ts;
128139
128397
  var entries = [];
128140
128398
  if (isUncheckedFile(sourceFile, compilerOptions)) {
128141
128399
  var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
128142
- /*replacementToken*/ undefined, contextToken, location, sourceFile, typeChecker, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
128400
+ /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
128143
128401
  getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217
128144
128402
  }
128145
128403
  else {
@@ -128147,7 +128405,7 @@ var ts;
128147
128405
  return undefined;
128148
128406
  }
128149
128407
  getCompletionEntriesFromSymbols(symbols, entries,
128150
- /*replacementToken*/ undefined, contextToken, location, sourceFile, typeChecker, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
128408
+ /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
128151
128409
  }
128152
128410
  if (keywordFilters !== 0 /* None */) {
128153
128411
  var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
@@ -128253,14 +128511,16 @@ var ts;
128253
128511
  function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
128254
128512
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
128255
128513
  }
128256
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences) {
128257
- 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;
128258
128516
  var insertText;
128259
128517
  var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
128260
128518
  var data;
128261
128519
  var isSnippet;
128520
+ var source = getSourceFromOrigin(origin);
128262
128521
  var sourceDisplay;
128263
128522
  var hasAction;
128523
+ var typeChecker = program.getTypeChecker();
128264
128524
  var insertQuestionDot = origin && originIsNullableMember(origin);
128265
128525
  var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
128266
128526
  if (origin && originIsThisType(origin)) {
@@ -128311,12 +128571,16 @@ var ts;
128311
128571
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
128312
128572
  }
128313
128573
  }
128314
- if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
128315
- return undefined;
128316
- }
128317
- if (originIsExport(origin) || originIsResolvedExport(origin)) {
128318
- data = originToCompletionEntryData(origin);
128319
- hasAction = !importCompletionNode;
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
+ }
128320
128584
  }
128321
128585
  var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
128322
128586
  if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
@@ -128328,7 +128592,7 @@ var ts;
128328
128592
  && !(type.flags & 1048576 /* Union */ && ts.find(type.types, function (type) { return !!(type.flags & 528 /* BooleanLike */); }))) {
128329
128593
  if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
128330
128594
  // If is string like or undefined use quotes
128331
- insertText = escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
128595
+ insertText = ts.escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
128332
128596
  isSnippet = true;
128333
128597
  }
128334
128598
  else {
@@ -128337,13 +128601,20 @@ var ts;
128337
128601
  }
128338
128602
  }
128339
128603
  if (useBraces_1) {
128340
- insertText = escapeSnippetText(name) + "={$1}";
128604
+ insertText = ts.escapeSnippetText(name) + "={$1}";
128341
128605
  isSnippet = true;
128342
128606
  }
128343
128607
  if (isSnippet) {
128344
128608
  replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
128345
128609
  }
128346
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
+ }
128347
128618
  // TODO(drosen): Right now we just permit *all* semantic meanings when calling
128348
128619
  // 'getSymbolKind' which is permissible given that it is backwards compatible; but
128349
128620
  // really we should consider passing the meaning for the node so that we don't report
@@ -128356,7 +128627,7 @@ var ts;
128356
128627
  kind: kind,
128357
128628
  kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
128358
128629
  sortText: sortText,
128359
- source: getSourceFromOrigin(origin),
128630
+ source: source,
128360
128631
  hasAction: hasAction ? true : undefined,
128361
128632
  isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
128362
128633
  insertText: insertText,
@@ -128368,8 +128639,172 @@ var ts;
128368
128639
  data: data,
128369
128640
  };
128370
128641
  }
128371
- function escapeSnippetText(text) {
128372
- return text.replace(/\$/gm, "\\$");
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
+ }
128373
128808
  }
128374
128809
  function originToCompletionEntryData(origin) {
128375
128810
  var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
@@ -128437,10 +128872,10 @@ var ts;
128437
128872
  var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? ts.tokenToString(151 /* TypeKeyword */) + " " : "";
128438
128873
  var suffix = useSemicolons ? ";" : "";
128439
128874
  switch (importKind) {
128440
- case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
128441
- case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
128442
- case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
128443
- 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 };
128444
128879
  }
128445
128880
  }
128446
128881
  function quotePropertyName(sourceFile, preferences, name) {
@@ -128464,11 +128899,12 @@ var ts;
128464
128899
  return CompletionSource.ThisProperty;
128465
128900
  }
128466
128901
  }
128467
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, typeChecker, target, log, kind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap) {
128902
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap) {
128468
128903
  var _a;
128469
128904
  var start = ts.timestamp();
128470
128905
  var variableDeclaration = getVariableDeclaration(location);
128471
128906
  var useSemicolons = ts.probablyUsesSemicolons(sourceFile);
128907
+ var typeChecker = program.getTypeChecker();
128472
128908
  // Tracks unique names.
128473
128909
  // Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
128474
128910
  // true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
@@ -128484,7 +128920,7 @@ var ts;
128484
128920
  var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
128485
128921
  var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
128486
128922
  var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
128487
- var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences);
128923
+ var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind);
128488
128924
  if (!entry) {
128489
128925
  continue;
128490
128926
  }
@@ -128577,11 +129013,13 @@ var ts;
128577
129013
  if (entryId.data) {
128578
129014
  var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
128579
129015
  if (autoImport) {
129016
+ var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
128580
129017
  return {
128581
129018
  type: "symbol",
128582
129019
  symbol: autoImport.symbol,
128583
129020
  location: ts.getTouchingPropertyName(sourceFile, position),
128584
- previousToken: ts.findPrecedingToken(position, sourceFile, /*startNode*/ undefined),
129021
+ previousToken: previousToken_1,
129022
+ contextToken: contextToken_1,
128585
129023
  isJsxInitializer: false,
128586
129024
  isTypeOnlyLocation: false,
128587
129025
  origin: autoImport.origin,
@@ -128596,7 +129034,7 @@ var ts;
128596
129034
  if (completionData.kind !== 0 /* Data */) {
128597
129035
  return { type: "request", request: completionData };
128598
129036
  }
128599
- 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;
128600
129038
  var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
128601
129039
  if (literal !== undefined)
128602
129040
  return { type: "literal", literal: literal };
@@ -128607,15 +129045,15 @@ var ts;
128607
129045
  return ts.firstDefined(symbols, function (symbol, index) {
128608
129046
  var origin = symbolToOriginInfoMap[index];
128609
129047
  var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
128610
- return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
128611
- ? { 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 }
128612
129050
  : undefined;
128613
129051
  }) || { type: "none" };
128614
129052
  }
128615
129053
  function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
128616
129054
  var typeChecker = program.getTypeChecker();
128617
129055
  var compilerOptions = program.getCompilerOptions();
128618
- var name = entryId.name;
129056
+ var name = entryId.name, source = entryId.source, data = entryId.data;
128619
129057
  var contextToken = ts.findPrecedingToken(position, sourceFile);
128620
129058
  if (ts.isInString(sourceFile, position, contextToken)) {
128621
129059
  return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
@@ -128639,8 +129077,8 @@ var ts;
128639
129077
  }
128640
129078
  }
128641
129079
  case "symbol": {
128642
- var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
128643
- var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, entryId.data), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay;
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;
128644
129082
  return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
128645
129083
  }
128646
129084
  case "literal": {
@@ -128669,14 +129107,27 @@ var ts;
128669
129107
  return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
128670
129108
  }
128671
129109
  Completions.createCompletionDetails = createCompletionDetails;
128672
- 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) {
128673
129111
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
128674
- var _a = getRelevantTokens(position, sourceFile), contextToken = _a.contextToken, previousToken_1 = _a.previousToken;
128675
- if (previousToken_1 && getImportStatementCompletionInfo(contextToken || previousToken_1).replacementNode) {
129112
+ var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
129113
+ if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
128676
129114
  // Import statement completion: 'import c|'
128677
129115
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
128678
129116
  }
128679
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
+ }
128680
129131
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
128681
129132
  return { codeActions: undefined, sourceDisplay: undefined };
128682
129133
  }
@@ -144517,7 +144968,7 @@ var ts;
144517
144968
  /** Note: output node may be mutated input node. */
144518
144969
  function getNonformattedText(node, sourceFile, newLineCharacter) {
144519
144970
  var writer = createWriter(newLineCharacter);
144520
- var newLine = newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
144971
+ var newLine = ts.getNewLineKind(newLineCharacter);
144521
144972
  ts.createPrinter({
144522
144973
  newLine: newLine,
144523
144974
  neverAsciiEscape: true,
@@ -144982,21 +145433,16 @@ var ts;
144982
145433
  (function (codefix) {
144983
145434
  var errorCodeToFixes = ts.createMultiMap();
144984
145435
  var fixIdToRegistration = new ts.Map();
144985
- function diagnosticToString(diag) {
144986
- return ts.isArray(diag)
144987
- ? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
144988
- : ts.getLocaleSpecificMessage(diag);
144989
- }
144990
145436
  function createCodeFixActionWithoutFixAll(fixName, changes, description) {
144991
- return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
145437
+ return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
144992
145438
  }
144993
145439
  codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
144994
145440
  function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
144995
- return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
145441
+ return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
144996
145442
  }
144997
145443
  codefix.createCodeFixAction = createCodeFixAction;
144998
145444
  function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
144999
- 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);
145000
145446
  }
145001
145447
  codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
145002
145448
  function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
@@ -147757,7 +148203,7 @@ var ts;
147757
148203
  var addToExisting = new ts.Map();
147758
148204
  /** Use `getNewImportEntry` for access */
147759
148205
  var newImports = new ts.Map();
147760
- return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
148206
+ return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
147761
148207
  function addImportFromDiagnostic(diagnostic, context) {
147762
148208
  var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
147763
148209
  if (!info || !info.fixes.length)
@@ -147908,6 +148354,9 @@ var ts;
147908
148354
  ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
147909
148355
  }
147910
148356
  }
148357
+ function hasFixes() {
148358
+ return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
148359
+ }
147911
148360
  }
147912
148361
  // Sorted with the preferred fix coming first.
147913
148362
  var ImportFixKind;
@@ -152118,7 +152567,7 @@ var ts;
152118
152567
  for (var _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) {
152119
152568
  var symbol = possiblyMissingSymbols_1[_i];
152120
152569
  if (!classMembers.has(symbol.escapedName)) {
152121
- addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement);
152570
+ addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement, /* body */ undefined);
152122
152571
  }
152123
152572
  }
152124
152573
  }
@@ -152131,9 +152580,11 @@ var ts;
152131
152580
  }
152132
152581
  codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
152133
152582
  /**
152134
- * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`.
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.
152135
152585
  */
152136
- 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; }
152137
152588
  var declarations = symbol.getDeclarations();
152138
152589
  if (!(declarations && declarations.length)) {
152139
152590
  return undefined;
@@ -152146,7 +152597,7 @@ var ts;
152146
152597
  var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
152147
152598
  var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
152148
152599
  var optional = !!(symbol.flags & 16777216 /* Optional */);
152149
- var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */);
152600
+ var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */) || isAmbient;
152150
152601
  var quotePreference = ts.getQuotePreference(sourceFile, preferences);
152151
152602
  switch (declaration.kind) {
152152
152603
  case 165 /* PropertySignature */:
@@ -152182,14 +152633,14 @@ var ts;
152182
152633
  var accessor = orderedAccessors_1[_i];
152183
152634
  if (ts.isGetAccessorDeclaration(accessor)) {
152184
152635
  addClassElement(ts.factory.createGetAccessorDeclaration(
152185
- /*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)));
152186
152637
  }
152187
152638
  else {
152188
152639
  ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter");
152189
152640
  var parameter = ts.getSetAccessorValueParameter(accessor);
152190
152641
  var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
152191
152642
  addClassElement(ts.factory.createSetAccessorDeclaration(
152192
- /*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)));
152193
152644
  }
152194
152645
  }
152195
152646
  break;
@@ -152210,7 +152661,7 @@ var ts;
152210
152661
  if (declarations.length === 1) {
152211
152662
  ts.Debug.assert(signatures.length === 1, "One declaration implies one signature");
152212
152663
  var signature = signatures[0];
152213
- outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(quotePreference));
152664
+ outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
152214
152665
  break;
152215
152666
  }
152216
152667
  for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
@@ -152221,11 +152672,11 @@ var ts;
152221
152672
  if (!ambient) {
152222
152673
  if (declarations.length > signatures.length) {
152223
152674
  var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
152224
- outputMethod(quotePreference, signature, modifiers, name, createStubbedMethodBody(quotePreference));
152675
+ outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference));
152225
152676
  }
152226
152677
  else {
152227
152678
  ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
152228
- addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference));
152679
+ addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
152229
152680
  }
152230
152681
  }
152231
152682
  break;
@@ -152236,6 +152687,7 @@ var ts;
152236
152687
  addClassElement(method);
152237
152688
  }
152238
152689
  }
152690
+ codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol;
152239
152691
  function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
152240
152692
  var program = context.program;
152241
152693
  var checker = program.getTypeChecker();
@@ -152373,7 +152825,7 @@ var ts;
152373
152825
  }
152374
152826
  return parameters;
152375
152827
  }
152376
- function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference) {
152828
+ function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body) {
152377
152829
  /** This is *a* signature with the maximal number of arguments,
152378
152830
  * such that if there is a "maximal" signature without rest arguments,
152379
152831
  * this is one of them.
@@ -152404,7 +152856,7 @@ var ts;
152404
152856
  parameters.push(restParameter);
152405
152857
  }
152406
152858
  return createStubbedMethod(modifiers, name, optional,
152407
- /*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference);
152859
+ /*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference, body);
152408
152860
  }
152409
152861
  function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
152410
152862
  if (ts.length(signatures)) {
@@ -152412,10 +152864,10 @@ var ts;
152412
152864
  return checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
152413
152865
  }
152414
152866
  }
152415
- function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference) {
152867
+ function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
152416
152868
  return ts.factory.createMethodDeclaration(
152417
152869
  /*decorators*/ undefined, modifiers,
152418
- /*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));
152419
152871
  }
152420
152872
  function createStubbedMethodBody(quotePreference) {
152421
152873
  return createStubbedBody(ts.Diagnostics.Method_not_implemented.message, quotePreference);
@@ -164451,6 +164903,10 @@ var ts;
164451
164903
  this.hasAddedOrRemovedSymlinks = true;
164452
164904
  }
164453
164905
  };
164906
+ /* @internal */
164907
+ Project.prototype.onDiscoveredSymlink = function () {
164908
+ this.hasAddedOrRemovedSymlinks = true;
164909
+ };
164454
164910
  /**
164455
164911
  * Updates set of files that contribute to this project
164456
164912
  * @returns: true if set of files in the project stays the same and false - otherwise.