typescript 4.7.0-dev.20220330 → 4.7.0-dev.20220331

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/protocol.d.ts CHANGED
@@ -1723,6 +1723,10 @@ declare namespace ts.server.protocol {
1723
1723
  * Human-readable description of the `source`.
1724
1724
  */
1725
1725
  sourceDisplay?: SymbolDisplayPart[];
1726
+ /**
1727
+ * Additional details for the label.
1728
+ */
1729
+ labelDetails?: CompletionEntryLabelDetails;
1726
1730
  /**
1727
1731
  * If true, this completion should be highlighted as recommended. There will only be one of these.
1728
1732
  * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class.
@@ -1751,6 +1755,20 @@ declare namespace ts.server.protocol {
1751
1755
  */
1752
1756
  data?: unknown;
1753
1757
  }
1758
+ interface CompletionEntryLabelDetails {
1759
+ /**
1760
+ * An optional string which is rendered less prominently directly after
1761
+ * {@link CompletionEntry.name name}, without any spacing. Should be
1762
+ * used for function signatures or type annotations.
1763
+ */
1764
+ detail?: string;
1765
+ /**
1766
+ * An optional string which is rendered less prominently after
1767
+ * {@link CompletionEntryLabelDetails.detail}. Should be used for fully qualified
1768
+ * names or file path.
1769
+ */
1770
+ description?: string;
1771
+ }
1754
1772
  /**
1755
1773
  * Additional completion entry details, available on demand
1756
1774
  */
@@ -2651,6 +2669,11 @@ declare namespace ts.server.protocol {
2651
2669
  * in addition to `const objectLiteral: T = { foo }`.
2652
2670
  */
2653
2671
  readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean;
2672
+ /**
2673
+ * Indicates whether {@link CompletionEntry.labelDetails completion entry label details} are supported.
2674
+ * If not, contents of `labelDetails` may be included in the {@link CompletionEntry.name} property.
2675
+ */
2676
+ readonly useLabelDetailsInCompletionEntries?: boolean;
2654
2677
  readonly allowIncompleteCompletions?: boolean;
2655
2678
  readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
2656
2679
  /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220330";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220331";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -6680,6 +6680,7 @@ var ts;
6680
6680
  An_expanded_version_of_this_information_showing_all_possible_compiler_options: diag(6928, ts.DiagnosticCategory.Message, "An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928", "An expanded version of this information, showing all possible compiler options"),
6681
6681
  Compiles_the_current_project_with_additional_settings: diag(6929, ts.DiagnosticCategory.Message, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."),
6682
6682
  true_for_ES2022_and_above_including_ESNext: diag(6930, ts.DiagnosticCategory.Message, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."),
6683
+ List_of_file_name_suffixes_to_search_when_resolving_a_module: diag(6931, ts.DiagnosticCategory.Error, "List_of_file_name_suffixes_to_search_when_resolving_a_module_6931", "List of file name suffixes to search when resolving a module."),
6683
6684
  Variable_0_implicitly_has_an_1_type: diag(7005, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."),
6684
6685
  Parameter_0_implicitly_has_an_1_type: diag(7006, ts.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."),
6685
6686
  Member_0_implicitly_has_an_1_type: diag(7008, ts.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."),
@@ -32051,6 +32052,18 @@ var ts;
32051
32052
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32052
32053
  defaultValueDescription: false,
32053
32054
  },
32055
+ {
32056
+ name: "moduleSuffixes",
32057
+ type: "list",
32058
+ element: {
32059
+ name: "suffix",
32060
+ type: "string",
32061
+ },
32062
+ listPreserveFalsyValues: true,
32063
+ affectsModuleResolution: true,
32064
+ category: ts.Diagnostics.Modules,
32065
+ description: ts.Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module,
32066
+ },
32054
32067
  {
32055
32068
  name: "sourceRoot",
32056
32069
  type: "string",
@@ -33806,7 +33819,7 @@ var ts;
33806
33819
  if (option.type === "list") {
33807
33820
  var listOption_1 = option;
33808
33821
  if (listOption_1.element.isFilePath || !ts.isString(listOption_1.element.type)) {
33809
- return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return !!v; });
33822
+ return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return listOption_1.listPreserveFalsyValues ? true : !!v; });
33810
33823
  }
33811
33824
  return value;
33812
33825
  }
@@ -33847,7 +33860,7 @@ var ts;
33847
33860
  }
33848
33861
  }
33849
33862
  function convertJsonOptionOfListType(option, values, basePath, errors) {
33850
- return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });
33863
+ return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return option.listPreserveFalsyValues ? true : !!v; });
33851
33864
  }
33852
33865
  var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
33853
33866
  var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
@@ -35180,6 +35193,15 @@ var ts;
35180
35193
  }
35181
35194
  }
35182
35195
  function tryFile(fileName, onlyRecordFailures, state) {
35196
+ var _a, _b;
35197
+ if (!((_a = state.compilerOptions.moduleSuffixes) === null || _a === void 0 ? void 0 : _a.length)) {
35198
+ return tryFileLookup(fileName, onlyRecordFailures, state);
35199
+ }
35200
+ var ext = (_b = ts.tryGetExtensionFromPath(fileName)) !== null && _b !== void 0 ? _b : "";
35201
+ var fileNameNoExtension = ext ? ts.removeExtension(fileName, ext) : fileName;
35202
+ return ts.forEach(state.compilerOptions.moduleSuffixes, function (suffix) { return tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state); });
35203
+ }
35204
+ function tryFileLookup(fileName, onlyRecordFailures, state) {
35183
35205
  if (!onlyRecordFailures) {
35184
35206
  if (state.host.fileExists(fileName)) {
35185
35207
  if (state.traceEnabled) {
@@ -42909,7 +42931,13 @@ var ts;
42909
42931
  if (!ts.nodeIsSynthesized(node) && ts.getParseTreeNode(node) === node) {
42910
42932
  return node;
42911
42933
  }
42912
- return ts.setTextRange(ts.factory.cloneNode(ts.visitEachChild(node, deepCloneOrReuseNode, ts.nullTransformationContext)), node);
42934
+ return ts.setTextRange(ts.factory.cloneNode(ts.visitEachChild(node, deepCloneOrReuseNode, ts.nullTransformationContext, deepCloneOrReuseNodes)), node);
42935
+ }
42936
+ function deepCloneOrReuseNodes(nodes, visitor, test, start, count) {
42937
+ if (nodes && nodes.length === 0) {
42938
+ return ts.setTextRange(ts.factory.createNodeArray(undefined, nodes.hasTrailingComma), nodes);
42939
+ }
42940
+ return ts.visitNodes(nodes, visitor, test, start, count);
42913
42941
  }
42914
42942
  }
42915
42943
  function createTypeNodeFromObjectType(type) {
@@ -59154,7 +59182,7 @@ var ts;
59154
59182
  if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
59155
59183
  var contextualSignature = getContextualSignature(func);
59156
59184
  if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
59157
- var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
59185
+ var restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
59158
59186
  if (restType.flags & 1048576 && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
59159
59187
  var narrowedType = getFlowTypeOfReference(func, restType, restType, undefined, location.flowNode);
59160
59188
  var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
@@ -60235,7 +60263,10 @@ var ts;
60235
60263
  return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
60236
60264
  }
60237
60265
  if (inferenceContext.returnMapper) {
60238
- return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
60266
+ var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
60267
+ return type.flags & 1048576 && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ?
60268
+ filterType(type, function (t) { return t !== regularFalseType && t !== regularTrueType; }) :
60269
+ type;
60239
60270
  }
60240
60271
  }
60241
60272
  }