typescript 4.6.0-dev.20220209 → 4.7.0-dev.20220215

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.
@@ -290,11 +290,11 @@ var ts;
290
290
  (function (ts) {
291
291
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
292
292
  // If changing the text in this section, be sure to test `configurePrerelease` too.
293
- ts.versionMajorMinor = "4.6";
293
+ ts.versionMajorMinor = "4.7";
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220209";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220215";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -7830,18 +7830,6 @@ var ts;
7830
7830
  return getCanonicalFileName(nonCanonicalizedPath);
7831
7831
  }
7832
7832
  ts.toPath = toPath;
7833
- function normalizePathAndParts(path) {
7834
- path = normalizeSlashes(path);
7835
- var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
7836
- if (parts.length) {
7837
- var joinedParts = root + parts.join(ts.directorySeparator);
7838
- return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
7839
- }
7840
- else {
7841
- return { path: root, parts: parts };
7842
- }
7843
- }
7844
- ts.normalizePathAndParts = normalizePathAndParts;
7845
7833
  function removeTrailingDirectorySeparator(path) {
7846
7834
  if (hasTrailingDirectorySeparator(path)) {
7847
7835
  return path.substr(0, path.length - 1);
@@ -8239,10 +8227,10 @@ var ts;
8239
8227
  A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."),
8240
8228
  A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."),
8241
8229
  An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."),
8242
- An_import_declaration_can_only_be_used_in_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", "An import declaration can only be used in a namespace or module."),
8243
- An_export_declaration_can_only_be_used_in_a_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_in_a_module_1233", "An export declaration can only be used in a module."),
8230
+ An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232", "An import declaration can only be used at the top level of a namespace or module."),
8231
+ An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233", "An export declaration can only be used at the top level of a namespace or module."),
8244
8232
  An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."),
8245
- A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", "A namespace declaration is only allowed in a namespace or module."),
8233
+ A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235", "A namespace declaration is only allowed at the top level of a namespace or module."),
8246
8234
  The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."),
8247
8235
  The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."),
8248
8236
  Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."),
@@ -8274,6 +8262,7 @@ var ts;
8274
8262
  An_optional_element_cannot_follow_a_rest_element: diag(1266, ts.DiagnosticCategory.Error, "An_optional_element_cannot_follow_a_rest_element_1266", "An optional element cannot follow a rest element."),
8275
8263
  Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."),
8276
8264
  An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),
8265
+ Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
8277
8266
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
8278
8267
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
8279
8268
  Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
@@ -8410,6 +8399,8 @@ var ts;
8410
8399
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8411
8400
  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: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "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."),
8412
8401
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
8402
+ An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8403
+ An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
8413
8404
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8414
8405
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8415
8406
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -9830,6 +9821,9 @@ var ts;
9830
9821
  Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
9831
9822
  Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
9832
9823
  Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
9824
+ Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
9825
+ Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
9826
+ Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
9833
9827
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
9834
9828
  Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
9835
9829
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -14330,6 +14324,10 @@ var ts;
14330
14324
  return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
14331
14325
  }
14332
14326
  ts.getSourceFileOfModule = getSourceFileOfModule;
14327
+ function isPlainJsFile(file, checkJs) {
14328
+ return !!file && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */) && !file.checkJsDirective && checkJs === undefined;
14329
+ }
14330
+ ts.isPlainJsFile = isPlainJsFile;
14333
14331
  function isStatementWithLocals(node) {
14334
14332
  switch (node.kind) {
14335
14333
  case 234 /* Block */:
@@ -41905,7 +41903,7 @@ var ts;
41905
41903
  result_4 = searchResult && searchResult.value;
41906
41904
  }
41907
41905
  else {
41908
- var candidate = ts.normalizePathAndParts(ts.combinePaths(initialLocationForSecondaryLookup, typeReferenceDirectiveName)).path;
41906
+ var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
41909
41907
  result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, /*onlyRecordFailures*/ false, moduleResolutionState, /*considerPackageJson*/ true);
41910
41908
  }
41911
41909
  return resolvedTypeScriptOnly(result_4);
@@ -42608,13 +42606,25 @@ var ts;
42608
42606
  return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
42609
42607
  }
42610
42608
  else {
42611
- var _a = ts.normalizePathAndParts(ts.combinePaths(containingDirectory, moduleName)), candidate = _a.path, parts = _a.parts;
42609
+ var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
42612
42610
  var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true);
42613
42611
  // Treat explicit "node_modules" import as an external library import.
42614
42612
  return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
42615
42613
  }
42616
42614
  }
42617
42615
  }
42616
+ // If you import from "." inside a containing directory "/foo", the result of `normalizePath`
42617
+ // would be "/foo", but this loses the information that `foo` is a directory and we intended
42618
+ // to look inside of it. The Node CommonJS resolution algorithm doesn't call this out
42619
+ // (https://nodejs.org/api/modules.html#all-together), but it seems that module paths ending
42620
+ // in `.` are actually normalized to `./` before proceeding with the resolution algorithm.
42621
+ function normalizePathForCJSResolution(containingDirectory, moduleName) {
42622
+ var combined = ts.combinePaths(containingDirectory, moduleName);
42623
+ var parts = ts.getPathComponents(combined);
42624
+ var lastPart = ts.lastOrUndefined(parts);
42625
+ var path = lastPart === "." || lastPart === ".." ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(combined)) : ts.normalizePath(combined);
42626
+ return { path: path, parts: parts };
42627
+ }
42618
42628
  function realPath(path, host, traceEnabled) {
42619
42629
  if (!host.realpath) {
42620
42630
  return path;
@@ -42656,7 +42666,13 @@ var ts;
42656
42666
  onlyRecordFailures = true;
42657
42667
  }
42658
42668
  }
42659
- return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42669
+ // esm mode relative imports shouldn't do any directory lookups (either inside `package.json`
42670
+ // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg`
42671
+ // could have been redirected by `./foo/pkg/package.json` to an arbitrary location!
42672
+ if (!(state.features & NodeResolutionFeatures.EsmMode)) {
42673
+ return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
42674
+ }
42675
+ return undefined;
42660
42676
  }
42661
42677
  /*@internal*/
42662
42678
  ts.nodeModulesPathPart = "/node_modules/";
@@ -43023,7 +43039,16 @@ var ts;
43023
43039
  // Even if extensions is DtsOnly, we can still look up a .ts file as a result of package.json "types"
43024
43040
  var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions;
43025
43041
  // Don't do package.json lookup recursively, because Node.js' package lookup doesn't.
43026
- return nodeLoadModuleByRelativeName(nextExtensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ false);
43042
+ // Disable `EsmMode` for the resolution of the package path for cjs-mode packages (so the `main` field can omit extensions)
43043
+ // (technically it only emits a deprecation warning in esm packages right now, but that's probably
43044
+ // enough to mean we don't need to support it)
43045
+ var features = state.features;
43046
+ if ((jsonContent === null || jsonContent === void 0 ? void 0 : jsonContent.type) !== "module") {
43047
+ state.features &= ~NodeResolutionFeatures.EsmMode;
43048
+ }
43049
+ var result = nodeLoadModuleByRelativeName(nextExtensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ false);
43050
+ state.features = features;
43051
+ return result;
43027
43052
  };
43028
43053
  var onlyRecordFailuresForPackageFile = packageFile ? !ts.directoryProbablyExists(ts.getDirectoryPath(packageFile), state.host) : undefined;
43029
43054
  var onlyRecordFailuresForIndex = onlyRecordFailures || !ts.directoryProbablyExists(candidate, state.host);
@@ -43368,6 +43393,14 @@ var ts;
43368
43393
  }
43369
43394
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
43370
43395
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
43396
+ if (!pathAndExtension && packageInfo
43397
+ && packageInfo.packageJsonContent.exports === undefined
43398
+ && packageInfo.packageJsonContent.main === undefined
43399
+ && state.features & NodeResolutionFeatures.EsmMode) {
43400
+ // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
43401
+ // a default `index.js` entrypoint if no `main` or `exports` are present
43402
+ pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
43403
+ }
43371
43404
  return withPackageId(packageInfo, pathAndExtension);
43372
43405
  };
43373
43406
  if (rest !== "") { // If "rest" is empty, we just did this search above.
@@ -47107,6 +47140,9 @@ var ts;
47107
47140
  CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
47108
47141
  CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
47109
47142
  CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
47143
+ CheckMode[CheckMode["RestBindingElement"] = 32] = "RestBindingElement";
47144
+ // e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
47145
+ // we need to preserve generic types instead of substituting them for constraints
47110
47146
  })(CheckMode || (CheckMode = {}));
47111
47147
  var SignatureCheckMode;
47112
47148
  (function (SignatureCheckMode) {
@@ -48159,13 +48195,13 @@ var ts;
48159
48195
  else { // error
48160
48196
  var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
48161
48197
  var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
48162
- var message = isEitherEnum
48163
- ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
48164
- : isEitherBlockScoped_1
48165
- ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
48198
+ var message = isEitherEnum ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
48199
+ : isEitherBlockScoped_1 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
48166
48200
  : ts.Diagnostics.Duplicate_identifier_0;
48167
48201
  var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
48168
48202
  var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
48203
+ var isSourcePlainJs = ts.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
48204
+ var isTargetPlainJs = ts.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
48169
48205
  var symbolName_1 = symbolToString(source);
48170
48206
  // Collect top-level duplicate identifier errors into one mapping, so we can then merge their diagnostics if there are a bunch
48171
48207
  if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
@@ -48177,12 +48213,16 @@ var ts;
48177
48213
  var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
48178
48214
  return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
48179
48215
  });
48180
- addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
48181
- addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
48216
+ if (!isSourcePlainJs)
48217
+ addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
48218
+ if (!isTargetPlainJs)
48219
+ addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
48182
48220
  }
48183
48221
  else {
48184
- addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
48185
- addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
48222
+ if (!isSourcePlainJs)
48223
+ addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
48224
+ if (!isTargetPlainJs)
48225
+ addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
48186
48226
  }
48187
48227
  }
48188
48228
  return target;
@@ -48639,6 +48679,8 @@ var ts;
48639
48679
  // type parameters are visible in parameter list, return type and type parameter list
48640
48680
  ? lastLocation === location.type ||
48641
48681
  lastLocation.kind === 163 /* Parameter */ ||
48682
+ lastLocation.kind === 338 /* JSDocParameterTag */ ||
48683
+ lastLocation.kind === 339 /* JSDocReturnTag */ ||
48642
48684
  lastLocation.kind === 162 /* TypeParameter */
48643
48685
  // local types not visible outside the function body
48644
48686
  : false;
@@ -48898,9 +48940,9 @@ var ts;
48898
48940
  lastSelfReferenceLocation = location;
48899
48941
  }
48900
48942
  lastLocation = location;
48901
- location = ts.isJSDocTemplateTag(location) ?
48902
- ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
48903
- location.parent;
48943
+ location = ts.isJSDocTemplateTag(location) ? ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
48944
+ ts.isJSDocParameterTag(location) || ts.isJSDocReturnTag(location) ? ts.getHostSignatureFromJSDoc(location) || location.parent :
48945
+ location.parent;
48904
48946
  }
48905
48947
  // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`.
48906
48948
  // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself.
@@ -50034,16 +50076,20 @@ var ts;
50034
50076
  return;
50035
50077
  }
50036
50078
  var host = ts.getJSDocHost(node);
50037
- if (host &&
50038
- ts.isExpressionStatement(host) &&
50039
- ts.isBinaryExpression(host.expression) &&
50040
- ts.getAssignmentDeclarationKind(host.expression) === 3 /* PrototypeProperty */) {
50041
- // X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
50079
+ if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) {
50080
+ // /** @param {K} p */ X.prototype.m = function () { } <-- look for K on X's declaration
50042
50081
  var symbol = getSymbolOfNode(host.expression.left);
50043
50082
  if (symbol) {
50044
50083
  return getDeclarationOfJSPrototypeContainer(symbol);
50045
50084
  }
50046
50085
  }
50086
+ if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) {
50087
+ // X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
50088
+ var symbol = getSymbolOfNode(host.parent.left);
50089
+ if (symbol) {
50090
+ return getDeclarationOfJSPrototypeContainer(symbol);
50091
+ }
50092
+ }
50047
50093
  if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
50048
50094
  ts.isBinaryExpression(host.parent.parent) &&
50049
50095
  ts.getAssignmentDeclarationKind(host.parent.parent) === 6 /* Prototype */) {
@@ -50572,8 +50618,15 @@ var ts;
50572
50618
  return res;
50573
50619
  }
50574
50620
  var candidates = ts.mapDefined(symbol.declarations, function (d) {
50575
- if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50576
- return getSymbolOfNode(d.parent);
50621
+ if (!ts.isAmbientModule(d) && d.parent) {
50622
+ // direct children of a module
50623
+ if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
50624
+ return getSymbolOfNode(d.parent);
50625
+ }
50626
+ // export ='d member of an ambient module
50627
+ if (ts.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) {
50628
+ return getSymbolOfNode(d.parent.parent);
50629
+ }
50577
50630
  }
50578
50631
  if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
50579
50632
  if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
@@ -54530,9 +54583,12 @@ var ts;
54530
54583
  }
54531
54584
  // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been
54532
54585
  // assigned by contextual typing.
54533
- function getTypeForBindingElementParent(node) {
54586
+ function getTypeForBindingElementParent(node, checkMode) {
54587
+ if (checkMode !== 0 /* Normal */) {
54588
+ return getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
54589
+ }
54534
54590
  var symbol = getSymbolOfNode(node);
54535
- return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
54591
+ return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
54536
54592
  }
54537
54593
  function getRestType(source, properties, symbol) {
54538
54594
  source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -54650,7 +54706,8 @@ var ts;
54650
54706
  }
54651
54707
  /** Return the inferred type for a binding element */
54652
54708
  function getTypeForBindingElement(declaration) {
54653
- var parentType = getTypeForBindingElementParent(declaration.parent.parent);
54709
+ var checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
54710
+ var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
54654
54711
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
54655
54712
  }
54656
54713
  function getBindingElementTypeFromParentType(declaration, parentType) {
@@ -54722,9 +54779,9 @@ var ts;
54722
54779
  if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
54723
54780
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
54724
54781
  // undefined from the final type.
54725
- return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
54782
+ return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
54726
54783
  }
54727
- return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2 /* Subtype */));
54784
+ return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
54728
54785
  }
54729
54786
  function getTypeForDeclarationFromJSDocComment(declaration) {
54730
54787
  var jsdocType = ts.getJSDocType(declaration);
@@ -54747,11 +54804,11 @@ var ts;
54747
54804
  return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
54748
54805
  }
54749
54806
  // Return the inferred type for a variable, parameter, or property declaration
54750
- function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
54807
+ function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) {
54751
54808
  // A variable declared in a for..in statement is of type string, or of type keyof T when the
54752
54809
  // right hand expression is of a type parameter type.
54753
54810
  if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242 /* ForInStatement */) {
54754
- var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
54811
+ var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode)));
54755
54812
  return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
54756
54813
  }
54757
54814
  if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* ForOfStatement */) {
@@ -54806,12 +54863,9 @@ var ts;
54806
54863
  }
54807
54864
  }
54808
54865
  if (ts.isInJSFile(declaration)) {
54809
- var typeTag = ts.getJSDocType(func);
54810
- if (typeTag && ts.isFunctionTypeNode(typeTag)) {
54811
- var signature = getSignatureFromDeclaration(typeTag);
54812
- var pos = func.parameters.indexOf(declaration);
54813
- return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
54814
- }
54866
+ var type_1 = getParameterTypeOfTypeTag(func, declaration);
54867
+ if (type_1)
54868
+ return type_1;
54815
54869
  }
54816
54870
  // Use contextual parameter type if one is available
54817
54871
  var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
@@ -54828,7 +54882,7 @@ var ts;
54828
54882
  return containerObjectType;
54829
54883
  }
54830
54884
  }
54831
- var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
54885
+ var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
54832
54886
  return addOptionality(type, isProperty, isOptional);
54833
54887
  }
54834
54888
  if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
@@ -55200,7 +55254,7 @@ var ts;
55200
55254
  // contextual type or, if the element itself is a binding pattern, with the type implied by that binding
55201
55255
  // pattern.
55202
55256
  var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType;
55203
- return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
55257
+ return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
55204
55258
  }
55205
55259
  if (ts.isBindingPattern(element.name)) {
55206
55260
  return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
@@ -55289,7 +55343,7 @@ var ts;
55289
55343
  // binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
55290
55344
  // tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
55291
55345
  function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
55292
- return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true), declaration, reportErrors);
55346
+ return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, 0 /* Normal */), declaration, reportErrors);
55293
55347
  }
55294
55348
  function isGlobalSymbolConstructor(node) {
55295
55349
  var symbol = getSymbolOfNode(node);
@@ -55378,9 +55432,9 @@ var ts;
55378
55432
  if (typeNode === undefined) {
55379
55433
  return useUnknownInCatchVariables ? unknownType : anyType;
55380
55434
  }
55381
- var type_1 = getTypeOfNode(typeNode);
55435
+ var type_2 = getTypeOfNode(typeNode);
55382
55436
  // an errorType will make `checkTryStatement` issue an error
55383
- return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
55437
+ return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
55384
55438
  }
55385
55439
  // Handle export default expressions
55386
55440
  if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
@@ -55518,10 +55572,12 @@ var ts;
55518
55572
  if (writing === void 0) { writing = false; }
55519
55573
  var getter = ts.getDeclarationOfKind(symbol, 171 /* GetAccessor */);
55520
55574
  var setter = ts.getDeclarationOfKind(symbol, 172 /* SetAccessor */);
55521
- var setterType = getAnnotatedAccessorType(setter);
55522
55575
  // For write operations, prioritize type annotations on the setter
55523
- if (writing && setterType) {
55524
- return instantiateTypeIfNeeded(setterType, symbol);
55576
+ if (writing) {
55577
+ var setterType_1 = getAnnotatedAccessorType(setter);
55578
+ if (setterType_1) {
55579
+ return instantiateTypeIfNeeded(setterType_1, symbol);
55580
+ }
55525
55581
  }
55526
55582
  // Else defer to the getter type
55527
55583
  if (getter && ts.isInJSFile(getter)) {
@@ -55536,6 +55592,7 @@ var ts;
55536
55592
  return instantiateTypeIfNeeded(getterType, symbol);
55537
55593
  }
55538
55594
  // If the user didn't specify a return type, try to use the set-accessor's parameter type.
55595
+ var setterType = getAnnotatedAccessorType(setter);
55539
55596
  if (setterType) {
55540
55597
  return setterType;
55541
55598
  }
@@ -55606,11 +55663,11 @@ var ts;
55606
55663
  return errorType;
55607
55664
  }
55608
55665
  var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
55609
- var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
55666
+ var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
55610
55667
  if (!popTypeResolution()) {
55611
55668
  return reportCircularityError(symbol);
55612
55669
  }
55613
- return type_2;
55670
+ return type_3;
55614
55671
  }
55615
55672
  }
55616
55673
  var type = createObjectType(16 /* Anonymous */, symbol);
@@ -57842,10 +57899,10 @@ var ts;
57842
57899
  var baseTypes = [];
57843
57900
  var different = false;
57844
57901
  for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
57845
- var type_3 = types_7[_i];
57846
- var baseType = getBaseConstraint(type_3);
57902
+ var type_4 = types_7[_i];
57903
+ var baseType = getBaseConstraint(type_4);
57847
57904
  if (baseType) {
57848
- if (baseType !== type_3) {
57905
+ if (baseType !== type_4) {
57849
57906
  different = true;
57850
57907
  }
57851
57908
  baseTypes.push(baseType);
@@ -58558,6 +58615,13 @@ var ts;
58558
58615
  var typeTag = ts.getJSDocTypeTag(node);
58559
58616
  return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
58560
58617
  }
58618
+ function getParameterTypeOfTypeTag(func, parameter) {
58619
+ var signature = getSignatureOfTypeTag(func);
58620
+ if (!signature)
58621
+ return undefined;
58622
+ var pos = func.parameters.indexOf(parameter);
58623
+ return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
58624
+ }
58561
58625
  function getReturnTypeOfTypeTag(node) {
58562
58626
  var signature = getSignatureOfTypeTag(node);
58563
58627
  return signature && getReturnTypeOfSignature(signature);
@@ -63297,9 +63361,11 @@ var ts;
63297
63361
  isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
63298
63362
  return true;
63299
63363
  }
63300
- if (s & 32768 /* Undefined */ && (!strictNullChecks || t & (32768 /* Undefined */ | 16384 /* Void */)))
63364
+ // In non-strictNullChecks mode, `undefined` and `null` are assignable to anything except `never`.
63365
+ // Since unions and intersections may reduce to `never`, we exclude them here.
63366
+ if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
63301
63367
  return true;
63302
- if (s & 65536 /* Null */ && (!strictNullChecks || t & 65536 /* Null */))
63368
+ if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
63303
63369
  return true;
63304
63370
  if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
63305
63371
  return true;
@@ -64755,6 +64821,11 @@ var ts;
64755
64821
  }
64756
64822
  if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target &&
64757
64823
  !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 /* MarkerType */ || ts.getObjectFlags(target) & 4096 /* MarkerType */)) {
64824
+ // When strictNullChecks is disabled, the element type of the empty array literal is undefinedWideningType,
64825
+ // and an empty array literal wouldn't be assignable to a `never[]` without this check.
64826
+ if (isEmptyArrayLiteralType(source)) {
64827
+ return -1 /* True */;
64828
+ }
64758
64829
  // We have type references to the same generic type, and the type references are not marker
64759
64830
  // type references (which are intended by be compared structurally). Obtain the variance
64760
64831
  // information for the type parameters and relate the type arguments accordingly.
@@ -65061,6 +65132,15 @@ var ts;
65061
65132
  }
65062
65133
  return 0 /* False */;
65063
65134
  }
65135
+ // Ensure {readonly a: whatever} is not a subtype of {a: whatever},
65136
+ // while {a: whatever} is a subtype of {readonly a: whatever}.
65137
+ // This ensures the subtype relationship is ordered, and preventing declaration order
65138
+ // from deciding which type "wins" in union subtype reduction.
65139
+ // They're still assignable to one another, since `readonly` doesn't affect assignability.
65140
+ if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65141
+ !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65142
+ return 0 /* False */;
65143
+ }
65064
65144
  // If the target comes from a partial union prop, allow `undefined` in the target type
65065
65145
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
65066
65146
  if (!related) {
@@ -70093,12 +70173,16 @@ var ts;
70093
70173
  function isGenericTypeWithoutNullableConstraint(type) {
70094
70174
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70095
70175
  }
70096
- function hasNonBindingPatternContextualTypeWithNoGenericTypes(node) {
70176
+ function hasContextualTypeWithNoGenericTypes(node, checkMode) {
70097
70177
  // Computing the contextual type for a child of a JSX element involves resolving the type of the
70098
70178
  // element's tag name, so we exclude that here to avoid circularities.
70179
+ // If check mode has `CheckMode.RestBindingElement`, we skip binding pattern contextual types,
70180
+ // as we want the type of a rest element to be generic when possible.
70099
70181
  var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
70100
70182
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
70101
- getContextualType(node, 8 /* SkipBindingPatterns */);
70183
+ (checkMode && checkMode & 32 /* RestBindingElement */ ?
70184
+ getContextualType(node, 8 /* SkipBindingPatterns */)
70185
+ : getContextualType(node));
70102
70186
  return contextualType && !isGenericType(contextualType);
70103
70187
  }
70104
70188
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -70111,7 +70195,7 @@ var ts;
70111
70195
  // 'string | undefined' to give control flow analysis the opportunity to narrow to type 'string'.
70112
70196
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
70113
70197
  someType(type, isGenericTypeWithUnionConstraint) &&
70114
- (isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
70198
+ (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
70115
70199
  return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
70116
70200
  }
70117
70201
  function isExportOrExportExpression(location) {
@@ -70179,7 +70263,7 @@ var ts;
70179
70263
  var links = getNodeLinks(location);
70180
70264
  if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
70181
70265
  links.flags |= 268435456 /* InCheckIdentifier */;
70182
- var parentType = getTypeForBindingElementParent(parent);
70266
+ var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
70183
70267
  links.flags &= ~268435456 /* InCheckIdentifier */;
70184
70268
  if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
70185
70269
  var pattern = declaration.parent;
@@ -71032,7 +71116,7 @@ var ts;
71032
71116
  var parent = declaration.parent.parent;
71033
71117
  var name = declaration.propertyName || declaration.name;
71034
71118
  var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
71035
- parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent);
71119
+ parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
71036
71120
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
71037
71121
  return undefined;
71038
71122
  if (parent.name.kind === 201 /* ArrayBindingPattern */) {
@@ -75743,8 +75827,8 @@ var ts;
75743
75827
  if (hasDefaultOnly && type && !isErrorType(type)) {
75744
75828
  var synthType = type;
75745
75829
  if (!synthType.defaultOnlyType) {
75746
- var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
75747
- synthType.defaultOnlyType = type_4;
75830
+ var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
75831
+ synthType.defaultOnlyType = type_5;
75748
75832
  }
75749
75833
  return synthType.defaultOnlyType;
75750
75834
  }
@@ -76198,7 +76282,7 @@ var ts;
76198
76282
  var links = getSymbolLinks(parameter);
76199
76283
  if (!links.type) {
76200
76284
  var declaration = parameter.valueDeclaration;
76201
- links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true);
76285
+ links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
76202
76286
  if (declaration.name.kind !== 79 /* Identifier */) {
76203
76287
  // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
76204
76288
  if (links.type === unknownType) {
@@ -76471,12 +76555,12 @@ var ts;
76471
76555
  var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
76472
76556
  // notEqualFacts states that the type of the switched value is not equal to every type in the switch.
76473
76557
  var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
76474
- var type_5 = getBaseConstraintOfType(operandType) || operandType;
76558
+ var type_6 = getBaseConstraintOfType(operandType) || operandType;
76475
76559
  // Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
76476
- if (type_5.flags & 3 /* AnyOrUnknown */) {
76560
+ if (type_6.flags & 3 /* AnyOrUnknown */) {
76477
76561
  return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
76478
76562
  }
76479
- return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
76563
+ return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
76480
76564
  }
76481
76565
  var type = getTypeOfExpression(node.expression);
76482
76566
  if (!isLiteralType(type)) {
@@ -77929,11 +78013,11 @@ var ts;
77929
78013
  }
77930
78014
  }
77931
78015
  function checkExpressionCached(node, checkMode) {
78016
+ if (checkMode && checkMode !== 0 /* Normal */) {
78017
+ return checkExpression(node, checkMode);
78018
+ }
77932
78019
  var links = getNodeLinks(node);
77933
78020
  if (!links.resolvedType) {
77934
- if (checkMode && checkMode !== 0 /* Normal */) {
77935
- return checkExpression(node, checkMode);
77936
- }
77937
78021
  // When computing a type that we're going to cache, we need to ignore any ongoing control flow
77938
78022
  // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart
77939
78023
  // to the top of the stack ensures all transient types are computed from a known point.
@@ -77953,10 +78037,12 @@ var ts;
77953
78037
  node.kind === 228 /* AsExpression */ ||
77954
78038
  ts.isJSDocTypeAssertion(node);
77955
78039
  }
77956
- function checkDeclarationInitializer(declaration, contextualType) {
78040
+ function checkDeclarationInitializer(declaration, checkMode, contextualType) {
77957
78041
  var initializer = ts.getEffectiveInitializer(declaration);
77958
78042
  var type = getQuickTypeOfExpression(initializer) ||
77959
- (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, 0 /* Normal */) : checkExpressionCached(initializer));
78043
+ (contextualType ?
78044
+ checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* Normal */)
78045
+ : checkExpressionCached(initializer, checkMode));
77960
78046
  return ts.isParameter(declaration) && declaration.name.kind === 201 /* ArrayBindingPattern */ &&
77961
78047
  isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
77962
78048
  padTupleType(type, declaration.name) : type;
@@ -78596,6 +78682,7 @@ var ts;
78596
78682
  }
78597
78683
  }
78598
78684
  checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
78685
+ checkUnmatchedJSDocParameters(node);
78599
78686
  ts.forEach(node.parameters, checkParameter);
78600
78687
  // TODO(rbuckton): Should we start checking JSDoc types?
78601
78688
  if (node.type) {
@@ -80167,31 +80254,6 @@ var ts;
80167
80254
  }
80168
80255
  function checkJSDocParameterTag(node) {
80169
80256
  checkSourceElement(node.typeExpression);
80170
- if (!ts.getParameterSymbolFromJSDoc(node)) {
80171
- var decl = ts.getHostSignatureFromJSDoc(node);
80172
- // don't issue an error for invalid hosts -- just functions --
80173
- // and give a better error message when the host function mentions `arguments`
80174
- // but the tag doesn't have an array type
80175
- if (decl) {
80176
- var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
80177
- if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
80178
- return;
80179
- }
80180
- if (!containsArgumentsReference(decl)) {
80181
- if (ts.isQualifiedName(node.name)) {
80182
- error(node.name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(node.name), ts.entityNameToString(node.name.left));
80183
- }
80184
- else {
80185
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
80186
- }
80187
- }
80188
- else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
80189
- node.typeExpression && node.typeExpression.type &&
80190
- !isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
80191
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 160 /* QualifiedName */ ? node.name.right : node.name));
80192
- }
80193
- }
80194
- }
80195
80257
  }
80196
80258
  function checkJSDocPropertyTag(node) {
80197
80259
  checkSourceElement(node.typeExpression);
@@ -80893,7 +80955,8 @@ var ts;
80893
80955
  }
80894
80956
  // check private/protected variable access
80895
80957
  var parent = node.parent.parent;
80896
- var parentType = getTypeForBindingElementParent(parent);
80958
+ var parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
80959
+ var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
80897
80960
  var name = node.propertyName || node.name;
80898
80961
  if (parentType && !ts.isBindingPattern(name)) {
80899
80962
  var exprType = getLiteralTypeFromPropertyName(name);
@@ -82132,7 +82195,7 @@ var ts;
82132
82195
  var declaration = catchClause.variableDeclaration;
82133
82196
  var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
82134
82197
  if (typeNode) {
82135
- var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false);
82198
+ var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false, 0 /* Normal */);
82136
82199
  if (type && !(type.flags & 3 /* AnyOrUnknown */)) {
82137
82200
  grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
82138
82201
  }
@@ -82263,6 +82326,45 @@ var ts;
82263
82326
  error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
82264
82327
  }
82265
82328
  }
82329
+ function checkUnmatchedJSDocParameters(node) {
82330
+ var jsdocParameters = ts.filter(ts.getJSDocTags(node), ts.isJSDocParameterTag);
82331
+ if (!ts.length(jsdocParameters))
82332
+ return;
82333
+ var isJs = ts.isInJSFile(node);
82334
+ var parameters = new ts.Set();
82335
+ var excludedParameters = new ts.Set();
82336
+ ts.forEach(node.parameters, function (_a, index) {
82337
+ var name = _a.name;
82338
+ if (ts.isIdentifier(name)) {
82339
+ parameters.add(name.escapedText);
82340
+ }
82341
+ if (ts.isBindingPattern(name)) {
82342
+ excludedParameters.add(index);
82343
+ }
82344
+ });
82345
+ var containsArguments = containsArgumentsReference(node);
82346
+ if (containsArguments) {
82347
+ var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
82348
+ if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
82349
+ lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
82350
+ errorOrSuggestion(isJs, lastJSDocParam.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(lastJSDocParam.name));
82351
+ }
82352
+ }
82353
+ else {
82354
+ ts.forEach(jsdocParameters, function (_a, index) {
82355
+ var name = _a.name;
82356
+ if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
82357
+ return;
82358
+ }
82359
+ if (ts.isQualifiedName(name)) {
82360
+ errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
82361
+ }
82362
+ else {
82363
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
82364
+ }
82365
+ });
82366
+ }
82367
+ }
82266
82368
  /**
82267
82369
  * Check each type parameter and check that type parameters have no duplicate type parameter declarations
82268
82370
  */
@@ -83238,7 +83340,7 @@ var ts;
83238
83340
  var isAmbientExternalModule = ts.isAmbientModule(node);
83239
83341
  var contextErrorMessage = isAmbientExternalModule
83240
83342
  ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
83241
- : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;
83343
+ : ts.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
83242
83344
  if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
83243
83345
  // If we hit a module declaration in an illegal context, just bail out to avoid cascading errors.
83244
83346
  return;
@@ -83471,6 +83573,9 @@ var ts;
83471
83573
  var name = ts.idText(node.kind === 269 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
83472
83574
  addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
83473
83575
  }
83576
+ if (isType && node.kind === 264 /* ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* Export */)) {
83577
+ error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);
83578
+ }
83474
83579
  break;
83475
83580
  }
83476
83581
  case 274 /* ExportSpecifier */: {
@@ -83554,7 +83659,7 @@ var ts;
83554
83659
  }
83555
83660
  }
83556
83661
  function checkImportDeclaration(node) {
83557
- if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {
83662
+ if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
83558
83663
  // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
83559
83664
  return;
83560
83665
  }
@@ -83587,7 +83692,7 @@ var ts;
83587
83692
  checkAssertClause(node);
83588
83693
  }
83589
83694
  function checkImportEqualsDeclaration(node) {
83590
- if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {
83695
+ if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
83591
83696
  // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
83592
83697
  return;
83593
83698
  }
@@ -83624,7 +83729,7 @@ var ts;
83624
83729
  }
83625
83730
  }
83626
83731
  function checkExportDeclaration(node) {
83627
- if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) {
83732
+ if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
83628
83733
  // If we hit an export in an illegal context, just bail out to avoid cascading errors.
83629
83734
  return;
83630
83735
  }
@@ -84858,7 +84963,7 @@ var ts;
84858
84963
  return errorType;
84859
84964
  }
84860
84965
  if (ts.isBindingPattern(node)) {
84861
- return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true) || errorType;
84966
+ return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true, 0 /* Normal */) || errorType;
84862
84967
  }
84863
84968
  if (isInRightSideOfImportOrExportAssignment(node)) {
84864
84969
  var symbol = getSymbolAtLocation(node);
@@ -114605,9 +114710,9 @@ var ts;
114605
114710
  ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
114606
114711
  ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
114607
114712
  ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
114608
- ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
114713
+ ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
114609
114714
  ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
114610
- ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
114715
+ ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
114611
114716
  ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
114612
114717
  ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
114613
114718
  ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
@@ -115675,7 +115780,7 @@ var ts;
115675
115780
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
115676
115781
  var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
115677
115782
  var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
115678
- var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
115783
+ var isPlainJs = ts.isPlainJsFile(sourceFile, options.checkJs);
115679
115784
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
115680
115785
  // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
115681
115786
  // - plain JS: .js files with no // ts-check and checkJs: undefined
@@ -127486,6 +127591,10 @@ var ts;
127486
127591
  return __assign(__assign({}, options), { semicolons: shouldRemoveSemicolons ? ts.SemicolonPreference.Remove : ts.SemicolonPreference.Ignore });
127487
127592
  }
127488
127593
  ts.getFormatCodeSettingsForWriting = getFormatCodeSettingsForWriting;
127594
+ function jsxModeNeedsExplicitImport(jsx) {
127595
+ return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
127596
+ }
127597
+ ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport;
127489
127598
  // #endregion
127490
127599
  })(ts || (ts = {}));
127491
127600
  /*@internal*/
@@ -129430,9 +129539,18 @@ var ts;
129430
129539
  return getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensionOptions, host, scriptPath);
129431
129540
  }
129432
129541
  }
129542
+ function isEmitResolutionKindUsingNodeModules(compilerOptions) {
129543
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
129544
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 ||
129545
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
129546
+ }
129547
+ function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
129548
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 ||
129549
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
129550
+ }
129433
129551
  function getSupportedExtensionsForModuleResolution(compilerOptions) {
129434
129552
  var extensions = ts.getSupportedExtensions(compilerOptions);
129435
- return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
129553
+ return isEmitResolutionKindUsingNodeModules(compilerOptions) ?
129436
129554
  ts.getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) :
129437
129555
  extensions;
129438
129556
  }
@@ -129595,7 +129713,7 @@ var ts;
129595
129713
  result.push(nameAndKind(ambientName, "external module name" /* externalModuleName */, /*extension*/ undefined));
129596
129714
  }
129597
129715
  getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
129598
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs) {
129716
+ if (isEmitResolutionKindUsingNodeModules(compilerOptions)) {
129599
129717
  // If looking for a global package name, don't just include everything in `node_modules` because that includes dependencies' own dependencies.
129600
129718
  // (But do if we didn't find anything, e.g. 'package.json' missing.)
129601
129719
  var foundGlobal = false;
@@ -129612,12 +129730,68 @@ var ts;
129612
129730
  }
129613
129731
  }
129614
129732
  if (!foundGlobal) {
129615
- ts.forEachAncestorDirectory(scriptPath, function (ancestor) {
129733
+ var ancestorLookup = function (ancestor) {
129616
129734
  var nodeModules = ts.combinePaths(ancestor, "node_modules");
129617
129735
  if (ts.tryDirectoryExists(host, nodeModules)) {
129618
129736
  getCompletionEntriesForDirectoryFragment(fragment, nodeModules, extensionOptions, host, /*exclude*/ undefined, result);
129619
129737
  }
129620
- });
129738
+ };
129739
+ if (fragmentDirectory && isEmitModuleResolutionRespectingExportMaps(compilerOptions)) {
129740
+ var nodeModulesDirectoryLookup_1 = ancestorLookup;
129741
+ ancestorLookup = function (ancestor) {
129742
+ var components = ts.getPathComponents(fragment);
129743
+ components.shift(); // shift off empty root
129744
+ var packagePath = components.shift();
129745
+ if (!packagePath) {
129746
+ return nodeModulesDirectoryLookup_1(ancestor);
129747
+ }
129748
+ if (ts.startsWith(packagePath, "@")) {
129749
+ var subName = components.shift();
129750
+ if (!subName) {
129751
+ return nodeModulesDirectoryLookup_1(ancestor);
129752
+ }
129753
+ packagePath = ts.combinePaths(packagePath, subName);
129754
+ }
129755
+ var packageFile = ts.combinePaths(ancestor, "node_modules", packagePath, "package.json");
129756
+ if (ts.tryFileExists(host, packageFile)) {
129757
+ var packageJson = ts.readJson(packageFile, host);
129758
+ var exports = packageJson.exports;
129759
+ if (exports) {
129760
+ if (typeof exports !== "object" || exports === null) { // eslint-disable-line no-null/no-null
129761
+ return; // null exports or entrypoint only, no sub-modules available
129762
+ }
129763
+ var keys = ts.getOwnKeys(exports);
129764
+ var fragmentSubpath_1 = components.join("/");
129765
+ var processedKeys = ts.mapDefined(keys, function (k) {
129766
+ if (k === ".")
129767
+ return undefined;
129768
+ if (!ts.startsWith(k, "./"))
129769
+ return undefined;
129770
+ var subpath = k.substring(2);
129771
+ if (!ts.startsWith(subpath, fragmentSubpath_1))
129772
+ return undefined;
129773
+ // subpath is a valid export (barring conditions, which we don't currently check here)
129774
+ if (!ts.stringContains(subpath, "*")) {
129775
+ return subpath;
129776
+ }
129777
+ // pattern export - only return everything up to the `*`, so the user can autocomplete, then
129778
+ // keep filling in the pattern (we could speculatively return a list of options by hitting disk,
129779
+ // but conditions will make that somewhat awkward, as each condition may have a different set of possible
129780
+ // options for the `*`.
129781
+ return subpath.slice(0, subpath.indexOf("*"));
129782
+ });
129783
+ ts.forEach(processedKeys, function (k) {
129784
+ if (k) {
129785
+ result.push(nameAndKind(k, "external module name" /* externalModuleName */, /*extension*/ undefined));
129786
+ }
129787
+ });
129788
+ return;
129789
+ }
129790
+ }
129791
+ return nodeModulesDirectoryLookup_1(ancestor);
129792
+ };
129793
+ }
129794
+ ts.forEachAncestorDirectory(scriptPath, ancestorLookup);
129621
129795
  }
129622
129796
  }
129623
129797
  return result;
@@ -139110,6 +139284,7 @@ var ts;
139110
139284
  return oldImports;
139111
139285
  }
139112
139286
  var typeChecker = program.getTypeChecker();
139287
+ var compilerOptions = program.getCompilerOptions();
139113
139288
  var jsxNamespace = typeChecker.getJsxNamespace(sourceFile);
139114
139289
  var jsxFragmentFactory = typeChecker.getJsxFragmentFactory(sourceFile);
139115
139290
  var jsxElementsPresent = !!(sourceFile.transformFlags & 2 /* ContainsJsx */);
@@ -139166,7 +139341,7 @@ var ts;
139166
139341
  return usedImports;
139167
139342
  function isDeclarationUsed(identifier) {
139168
139343
  // The JSX factory symbol is always used if JSX elements are present - even if they are not allowed.
139169
- return jsxElementsPresent && (identifier.text === jsxNamespace || jsxFragmentFactory && identifier.text === jsxFragmentFactory) ||
139344
+ return jsxElementsPresent && (identifier.text === jsxNamespace || jsxFragmentFactory && identifier.text === jsxFragmentFactory) && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx) ||
139170
139345
  ts.FindAllReferences.Core.isSymbolReferencedInFile(identifier, typeChecker, sourceFile);
139171
139346
  }
139172
139347
  }
@@ -146406,8 +146581,18 @@ var ts;
146406
146581
  var indent = sourceFile.text.slice(startPosition, fnStart);
146407
146582
  this.insertNodeAt(sourceFile, fnStart, tag, { preserveLeadingWhitespace: false, suffix: this.newLineCharacter + indent });
146408
146583
  };
146584
+ ChangeTracker.prototype.createJSDocText = function (sourceFile, node) {
146585
+ var comments = ts.flatMap(node.jsDoc, function (jsDoc) {
146586
+ return ts.isString(jsDoc.comment) ? ts.factory.createJSDocText(jsDoc.comment) : jsDoc.comment;
146587
+ });
146588
+ var jsDoc = ts.singleOrUndefined(node.jsDoc);
146589
+ return jsDoc && ts.positionsAreOnSameLine(jsDoc.pos, jsDoc.end, sourceFile) && ts.length(comments) === 0 ? undefined :
146590
+ ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n")));
146591
+ };
146592
+ ChangeTracker.prototype.replaceJSDocComment = function (sourceFile, node, tags) {
146593
+ this.insertJsdocCommentBefore(sourceFile, updateJSDocHost(node), ts.factory.createJSDocComment(this.createJSDocText(sourceFile, node), ts.factory.createNodeArray(tags)));
146594
+ };
146409
146595
  ChangeTracker.prototype.addJSDocTags = function (sourceFile, parent, newTags) {
146410
- var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; });
146411
146596
  var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; });
146412
146597
  var unmergedNewTags = newTags.filter(function (newTag) { return !oldTags.some(function (tag, i) {
146413
146598
  var merged = tryMergeJsdocTags(tag, newTag);
@@ -146415,20 +146600,10 @@ var ts;
146415
146600
  oldTags[i] = merged;
146416
146601
  return !!merged;
146417
146602
  }); });
146418
- var tags = __spreadArray(__spreadArray([], oldTags, true), unmergedNewTags, true);
146419
- var jsDoc = ts.singleOrUndefined(parent.jsDoc);
146420
- var comment = jsDoc && ts.positionsAreOnSameLine(jsDoc.pos, jsDoc.end, sourceFile) && !ts.length(comments) ? undefined :
146421
- ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n")));
146422
- var tag = ts.factory.createJSDocComment(comment, ts.factory.createNodeArray(tags));
146423
- var host = updateJSDocHost(parent);
146424
- this.insertJsdocCommentBefore(sourceFile, host, tag);
146603
+ this.replaceJSDocComment(sourceFile, parent, __spreadArray(__spreadArray([], oldTags, true), unmergedNewTags, true));
146425
146604
  };
146426
146605
  ChangeTracker.prototype.filterJSDocTags = function (sourceFile, parent, predicate) {
146427
- var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; });
146428
- var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; });
146429
- var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray([], (ts.filter(oldTags, predicate) || ts.emptyArray), true)));
146430
- var host = updateJSDocHost(parent);
146431
- this.insertJsdocCommentBefore(sourceFile, host, tag);
146606
+ this.replaceJSDocComment(sourceFile, parent, ts.filter(ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; }), predicate));
146432
146607
  };
146433
146608
  ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
146434
146609
  this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: range, text: text });
@@ -150223,9 +150398,9 @@ var ts;
150223
150398
  var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions));
150224
150399
  var checker = program.getTypeChecker();
150225
150400
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
150226
- var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
150401
+ var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
150227
150402
  var useRequire = shouldUseRequire(sourceFile, program);
150228
- var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
150403
+ var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
150229
150404
  if (fix) {
150230
150405
  addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
150231
150406
  }
@@ -150414,7 +150589,7 @@ var ts;
150414
150589
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
150415
150590
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
150416
150591
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
150417
- return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
150592
+ return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter, host);
150418
150593
  }
150419
150594
  function codeFixActionToCodeAction(_a) {
150420
150595
  var description = _a.description, changes = _a.changes, commands = _a.commands;
@@ -150474,7 +150649,7 @@ var ts;
150474
150649
  /*position*/ undefined,
150475
150650
  /*isValidTypeOnlyUseSite*/ false,
150476
150651
  /*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
150477
- var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
150652
+ var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host), host);
150478
150653
  return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
150479
150654
  }
150480
150655
  codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
@@ -150644,7 +150819,7 @@ var ts;
150644
150819
  // 5. Literally nothing to go on
150645
150820
  return true;
150646
150821
  }
150647
- function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, moduleSymbols, host, preferences, fromCacheOnly) {
150822
+ function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) {
150648
150823
  var isJs = ts.isSourceFileJS(sourceFile);
150649
150824
  var compilerOptions = program.getCompilerOptions();
150650
150825
  var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host);
@@ -150653,7 +150828,7 @@ var ts;
150653
150828
  ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); }
150654
150829
  : function (moduleSymbol, checker) { return ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); };
150655
150830
  var computedWithoutCacheCount = 0;
150656
- var fixes = ts.flatMap(moduleSymbols, function (exportInfo) {
150831
+ var fixes = ts.flatMap(exportInfo, function (exportInfo, i) {
150657
150832
  var checker = getChecker(exportInfo.isFromPackageJson);
150658
150833
  var _a = getModuleSpecifiers(exportInfo.moduleSymbol, checker), computedWithoutCache = _a.computedWithoutCache, moduleSpecifiers = _a.moduleSpecifiers;
150659
150834
  var importedSymbolHasValueMeaning = !!(exportInfo.targetFlags & 111551 /* Value */);
@@ -150662,7 +150837,7 @@ var ts;
150662
150837
  return moduleSpecifiers === null || moduleSpecifiers === void 0 ? void 0 : moduleSpecifiers.map(function (moduleSpecifier) {
150663
150838
  // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
150664
150839
  return !importedSymbolHasValueMeaning && isJs && position !== undefined
150665
- ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo }
150840
+ ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 }
150666
150841
  : {
150667
150842
  kind: 3 /* AddNew */,
150668
150843
  moduleSpecifier: moduleSpecifier,
@@ -150670,6 +150845,7 @@ var ts;
150670
150845
  useRequire: useRequire,
150671
150846
  addAsTypeOnly: addAsTypeOnly,
150672
150847
  exportInfo: exportInfo,
150848
+ isReExport: i > 0,
150673
150849
  };
150674
150850
  });
150675
150851
  });
@@ -150707,12 +150883,13 @@ var ts;
150707
150883
  info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
150708
150884
  }
150709
150885
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
150710
- return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
150886
+ return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) });
150711
150887
  }
150712
- function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
150713
- return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
150888
+ function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) {
150889
+ var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); };
150890
+ return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); });
150714
150891
  }
150715
- function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
150892
+ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
150716
150893
  if (!ts.some(fixes))
150717
150894
  return;
150718
150895
  // These will always be placed first if available, and are better than other kinds
@@ -150721,22 +150898,37 @@ var ts;
150721
150898
  }
150722
150899
  return fixes.reduce(function (best, fix) {
150723
150900
  // Takes true branch of conditional if `fix` is better than `best`
150724
- return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
150901
+ return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }) === -1 /* LessThan */ ? fix : best;
150725
150902
  });
150726
150903
  }
150727
150904
  /** @returns `Comparison.LessThan` if `a` is better than `b`. */
150728
- function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier) {
150905
+ function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath) {
150729
150906
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
150730
150907
  return ts.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier))
150731
150908
  || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program)
150732
- || ts.compareBooleans(isOnlyDotsAndSlashes(a.moduleSpecifier), isOnlyDotsAndSlashes(b.moduleSpecifier))
150909
+ || ts.compareBooleans(isFixPossiblyReExportingImportingFile(a, importingFile, program.getCompilerOptions(), toPath), isFixPossiblyReExportingImportingFile(b, importingFile, program.getCompilerOptions(), toPath))
150733
150910
  || ts.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
150734
150911
  }
150735
150912
  return 0 /* EqualTo */;
150736
150913
  }
150737
- var notDotOrSlashPattern = /[^.\/]/;
150738
- function isOnlyDotsAndSlashes(path) {
150739
- return !notDotOrSlashPattern.test(path);
150914
+ // This is a simple heuristic to try to avoid creating an import cycle with a barrel re-export.
150915
+ // E.g., do not `import { Foo } from ".."` when you could `import { Foo } from "../Foo"`.
150916
+ // This can produce false positives or negatives if re-exports cross into sibling directories
150917
+ // (e.g. `export * from "../whatever"`) or are not named "index" (we don't even try to consider
150918
+ // this if we're in a resolution mode where you can't drop trailing "/index" from paths).
150919
+ function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath) {
150920
+ var _a;
150921
+ if (fix.isReExport &&
150922
+ ((_a = fix.exportInfo) === null || _a === void 0 ? void 0 : _a.moduleFileName) &&
150923
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs &&
150924
+ isIndexFileName(fix.exportInfo.moduleFileName)) {
150925
+ var reExportDir = toPath(ts.getDirectoryPath(fix.exportInfo.moduleFileName));
150926
+ return ts.startsWith((importingFile.path), reExportDir);
150927
+ }
150928
+ return false;
150929
+ }
150930
+ function isIndexFileName(fileName) {
150931
+ return ts.getBaseFileName(fileName, [".js", ".jsx", ".d.ts", ".ts", ".tsx"], /*ignoreCase*/ true) === "index";
150740
150932
  }
150741
150933
  function compareNodeCoreModuleSpecifiers(a, b, importingFile, program) {
150742
150934
  if (ts.startsWith(a, "node:") && !ts.startsWith(b, "node:"))
@@ -150754,9 +150946,9 @@ var ts;
150754
150946
  return undefined;
150755
150947
  var symbol = checker.getAliasedSymbol(umdSymbol);
150756
150948
  var symbolName = umdSymbol.name;
150757
- var exportInfos = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
150949
+ var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
150758
150950
  var useRequire = shouldUseRequire(sourceFile, program);
150759
- var fixes = getImportFixes(exportInfos, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
150951
+ var fixes = getImportFixes(exportInfo, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
150760
150952
  return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
150761
150953
  }
150762
150954
  function getUmdSymbol(token, checker) {
@@ -150823,8 +151015,8 @@ var ts;
150823
151015
  ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
150824
151016
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
150825
151017
  var useRequire = shouldUseRequire(sourceFile, program);
150826
- var exportInfos = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
150827
- var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfos.entries(), function (_a) {
151018
+ var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
151019
+ var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
150828
151020
  var _ = _a[0], exportInfos = _a[1];
150829
151021
  return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
150830
151022
  }));
@@ -150840,12 +151032,9 @@ var ts;
150840
151032
  return undefined;
150841
151033
  return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
150842
151034
  }
150843
- function jsxModeNeedsExplicitImport(jsx) {
150844
- return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
150845
- }
150846
151035
  function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) {
150847
151036
  var parent = symbolToken.parent;
150848
- if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
151037
+ if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
150849
151038
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
150850
151039
  if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
150851
151040
  return jsxNamespace;
@@ -152925,6 +153114,95 @@ var ts;
152925
153114
  })(ts || (ts = {}));
152926
153115
  /* @internal */
152927
153116
  var ts;
153117
+ (function (ts) {
153118
+ var codefix;
153119
+ (function (codefix) {
153120
+ var deleteUnmatchedParameter = "deleteUnmatchedParameter";
153121
+ var renameUnmatchedParameter = "renameUnmatchedParameter";
153122
+ var errorCodes = [
153123
+ ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code,
153124
+ ];
153125
+ codefix.registerCodeFix({
153126
+ fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
153127
+ errorCodes: errorCodes,
153128
+ getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
153129
+ var sourceFile = context.sourceFile, span = context.span;
153130
+ var actions = [];
153131
+ var info = getInfo(sourceFile, span.start);
153132
+ if (info) {
153133
+ ts.append(actions, getDeleteAction(context, info));
153134
+ ts.append(actions, getRenameAction(context, info));
153135
+ return actions;
153136
+ }
153137
+ return undefined;
153138
+ },
153139
+ getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
153140
+ var tagsToSignature = new ts.Map();
153141
+ return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
153142
+ codefix.eachDiagnostic(context, errorCodes, function (_a) {
153143
+ var file = _a.file, start = _a.start;
153144
+ var info = getInfo(file, start);
153145
+ if (info) {
153146
+ tagsToSignature.set(info.signature, ts.append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
153147
+ }
153148
+ });
153149
+ tagsToSignature.forEach(function (tags, signature) {
153150
+ if (context.fixId === deleteUnmatchedParameter) {
153151
+ var tagsSet_1 = new ts.Set(tags);
153152
+ changes.filterJSDocTags(signature.getSourceFile(), signature, function (t) { return !tagsSet_1.has(t); });
153153
+ }
153154
+ });
153155
+ }));
153156
+ }
153157
+ });
153158
+ function getDeleteAction(context, _a) {
153159
+ var name = _a.name, signature = _a.signature, jsDocParameterTag = _a.jsDocParameterTag;
153160
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) {
153161
+ return changeTracker.filterJSDocTags(context.sourceFile, signature, function (t) { return t !== jsDocParameterTag; });
153162
+ });
153163
+ return codefix.createCodeFixAction(deleteUnmatchedParameter, changes, [ts.Diagnostics.Delete_unused_param_tag_0, name.getText(context.sourceFile)], deleteUnmatchedParameter, ts.Diagnostics.Delete_all_unused_param_tags);
153164
+ }
153165
+ function getRenameAction(context, _a) {
153166
+ var name = _a.name, signature = _a.signature, jsDocParameterTag = _a.jsDocParameterTag;
153167
+ if (!ts.length(signature.parameters))
153168
+ return undefined;
153169
+ var sourceFile = context.sourceFile;
153170
+ var tags = ts.getJSDocTags(signature);
153171
+ var names = new ts.Set();
153172
+ for (var _i = 0, tags_2 = tags; _i < tags_2.length; _i++) {
153173
+ var tag = tags_2[_i];
153174
+ if (ts.isJSDocParameterTag(tag) && ts.isIdentifier(tag.name)) {
153175
+ names.add(tag.name.escapedText);
153176
+ }
153177
+ }
153178
+ // @todo - match to all available names instead to the first parameter name
153179
+ // @see /codeFixRenameUnmatchedParameter3.ts
153180
+ var parameterName = ts.firstDefined(signature.parameters, function (p) {
153181
+ return ts.isIdentifier(p.name) && !names.has(p.name.escapedText) ? p.name.getText(sourceFile) : undefined;
153182
+ });
153183
+ if (parameterName === undefined)
153184
+ return undefined;
153185
+ var newJSDocParameterTag = ts.factory.updateJSDocParameterTag(jsDocParameterTag, jsDocParameterTag.tagName, ts.factory.createIdentifier(parameterName), jsDocParameterTag.isBracketed, jsDocParameterTag.typeExpression, jsDocParameterTag.isNameFirst, jsDocParameterTag.comment);
153186
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) {
153187
+ return changeTracker.replaceJSDocComment(sourceFile, signature, ts.map(tags, function (t) { return t === jsDocParameterTag ? newJSDocParameterTag : t; }));
153188
+ });
153189
+ return codefix.createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [ts.Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
153190
+ }
153191
+ function getInfo(sourceFile, pos) {
153192
+ var token = ts.getTokenAtPosition(sourceFile, pos);
153193
+ if (token.parent && ts.isJSDocParameterTag(token.parent) && ts.isIdentifier(token.parent.name)) {
153194
+ var jsDocParameterTag = token.parent;
153195
+ var signature = ts.getHostSignatureFromJSDoc(jsDocParameterTag);
153196
+ if (signature) {
153197
+ return { signature: signature, name: token.parent.name, jsDocParameterTag: jsDocParameterTag };
153198
+ }
153199
+ }
153200
+ return undefined;
153201
+ }
153202
+ })(codefix = ts.codefix || (ts.codefix = {}));
153203
+ })(ts || (ts = {}));
153204
+ /* @internal */
153205
+ var ts;
152928
153206
  (function (ts) {
152929
153207
  var codefix;
152930
153208
  (function (codefix) {