typescript 4.7.0-dev.20220328 → 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
  */
@@ -2644,6 +2662,18 @@ declare namespace ts.server.protocol {
2644
2662
  * `class A { foo }`.
2645
2663
  */
2646
2664
  readonly includeCompletionsWithClassMemberSnippets?: boolean;
2665
+ /**
2666
+ * If enabled, object literal methods will have a method declaration completion entry in addition
2667
+ * to the regular completion entry containing just the method name.
2668
+ * E.g., `const objectLiteral: T = { f| }` could be completed to `const objectLiteral: T = { foo(): void {} }`,
2669
+ * in addition to `const objectLiteral: T = { foo }`.
2670
+ */
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;
2647
2677
  readonly allowIncompleteCompletions?: boolean;
2648
2678
  readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
2649
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.20220328";
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."),
@@ -10092,7 +10093,9 @@ var ts;
10092
10093
  || kind === 174
10093
10094
  || kind === 166
10094
10095
  || kind === 168
10095
- || kind === 176;
10096
+ || kind === 176
10097
+ || kind === 172
10098
+ || kind === 173;
10096
10099
  }
10097
10100
  ts.isTypeElement = isTypeElement;
10098
10101
  function isClassOrTypeElement(node) {
@@ -32049,6 +32052,18 @@ var ts;
32049
32052
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32050
32053
  defaultValueDescription: false,
32051
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
+ },
32052
32067
  {
32053
32068
  name: "sourceRoot",
32054
32069
  type: "string",
@@ -33804,7 +33819,7 @@ var ts;
33804
33819
  if (option.type === "list") {
33805
33820
  var listOption_1 = option;
33806
33821
  if (listOption_1.element.isFilePath || !ts.isString(listOption_1.element.type)) {
33807
- 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; });
33808
33823
  }
33809
33824
  return value;
33810
33825
  }
@@ -33845,7 +33860,7 @@ var ts;
33845
33860
  }
33846
33861
  }
33847
33862
  function convertJsonOptionOfListType(option, values, basePath, errors) {
33848
- 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; });
33849
33864
  }
33850
33865
  var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
33851
33866
  var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
@@ -35178,6 +35193,15 @@ var ts;
35178
35193
  }
35179
35194
  }
35180
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) {
35181
35205
  if (!onlyRecordFailures) {
35182
35206
  if (state.host.fileExists(fileName)) {
35183
35207
  if (state.traceEnabled) {
@@ -39072,26 +39096,10 @@ var ts;
39072
39096
  if (!node) {
39073
39097
  return undefined;
39074
39098
  }
39075
- var containingCall = ts.findAncestor(node, ts.isCallLikeExpression);
39076
- var containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
39077
- if (contextFlags & 4 && containingCall) {
39078
- var toMarkSkip = node;
39079
- do {
39080
- getNodeLinks(toMarkSkip).skipDirectInference = true;
39081
- toMarkSkip = toMarkSkip.parent;
39082
- } while (toMarkSkip && toMarkSkip !== containingCall);
39083
- getNodeLinks(containingCall).resolvedSignature = undefined;
39084
- }
39085
- var result = getContextualType(node, contextFlags);
39086
- if (contextFlags & 4 && containingCall) {
39087
- var toMarkSkip = node;
39088
- do {
39089
- getNodeLinks(toMarkSkip).skipDirectInference = undefined;
39090
- toMarkSkip = toMarkSkip.parent;
39091
- } while (toMarkSkip && toMarkSkip !== containingCall);
39092
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
39099
+ if (contextFlags & 4) {
39100
+ return runWithInferenceBlockedFromSourceNode(node, function () { return getContextualType(node, contextFlags); });
39093
39101
  }
39094
- return result;
39102
+ return getContextualType(node, contextFlags);
39095
39103
  },
39096
39104
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
39097
39105
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
@@ -39111,6 +39119,9 @@ var ts;
39111
39119
  getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
39112
39120
  return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0);
39113
39121
  },
39122
+ getResolvedSignatureForStringLiteralCompletions: function (call, editingArgument, candidatesOutArray) {
39123
+ return getResolvedSignatureWorker(call, candidatesOutArray, undefined, 32, editingArgument);
39124
+ },
39114
39125
  getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
39115
39126
  return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16);
39116
39127
  },
@@ -39257,10 +39268,34 @@ var ts;
39257
39268
  getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
39258
39269
  getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
39259
39270
  };
39260
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
39271
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
39272
+ var containingCall = ts.findAncestor(node, ts.isCallLikeExpression);
39273
+ var containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
39274
+ if (containingCall) {
39275
+ var toMarkSkip = node;
39276
+ do {
39277
+ getNodeLinks(toMarkSkip).skipDirectInference = true;
39278
+ toMarkSkip = toMarkSkip.parent;
39279
+ } while (toMarkSkip && toMarkSkip !== containingCall);
39280
+ getNodeLinks(containingCall).resolvedSignature = undefined;
39281
+ }
39282
+ var result = fn();
39283
+ if (containingCall) {
39284
+ var toMarkSkip = node;
39285
+ do {
39286
+ getNodeLinks(toMarkSkip).skipDirectInference = undefined;
39287
+ toMarkSkip = toMarkSkip.parent;
39288
+ } while (toMarkSkip && toMarkSkip !== containingCall);
39289
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
39290
+ }
39291
+ return result;
39292
+ }
39293
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
39261
39294
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
39262
39295
  apparentArgumentCount = argumentCount;
39263
- var res = node ? getResolvedSignature(node, candidatesOutArray, checkMode) : undefined;
39296
+ var res = !node ? undefined :
39297
+ editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, function () { return getResolvedSignature(node, candidatesOutArray, checkMode); }) :
39298
+ getResolvedSignature(node, candidatesOutArray, checkMode);
39264
39299
  apparentArgumentCount = undefined;
39265
39300
  return res;
39266
39301
  }
@@ -40140,6 +40175,10 @@ var ts;
40140
40175
  }
40141
40176
  }
40142
40177
  }
40178
+ function isConstAssertion(location) {
40179
+ return (ts.isAssertionExpression(location) && ts.isConstTypeReference(location.type))
40180
+ || (ts.isJSDocTypeTag(location) && ts.isConstTypeReference(location.typeExpression));
40181
+ }
40143
40182
  function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
40144
40183
  if (excludeGlobals === void 0) { excludeGlobals = false; }
40145
40184
  if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
@@ -40158,6 +40197,9 @@ var ts;
40158
40197
  var grandparent;
40159
40198
  var isInExternalModule = false;
40160
40199
  loop: while (location) {
40200
+ if (name === "const" && isConstAssertion(location)) {
40201
+ return undefined;
40202
+ }
40161
40203
  if (location.locals && !isGlobalSourceFile(location)) {
40162
40204
  if (result = lookup(location.locals, name, meaning)) {
40163
40205
  var useResult = true;
@@ -42889,7 +42931,13 @@ var ts;
42889
42931
  if (!ts.nodeIsSynthesized(node) && ts.getParseTreeNode(node) === node) {
42890
42932
  return node;
42891
42933
  }
42892
- 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);
42893
42941
  }
42894
42942
  }
42895
42943
  function createTypeNodeFromObjectType(type) {
@@ -45282,6 +45330,8 @@ var ts;
45282
45330
  return !!target.resolvedTypeArguments;
45283
45331
  case 7:
45284
45332
  return !!target.baseTypesResolved;
45333
+ case 8:
45334
+ return !!getSymbolLinks(target).writeType;
45285
45335
  }
45286
45336
  return ts.Debug.assertNever(propertyName);
45287
45337
  }
@@ -45433,7 +45483,7 @@ var ts;
45433
45483
  return type.flags & (128 | 256) ? "" + type.value : undefined;
45434
45484
  }
45435
45485
  function getTypeForBindingElement(declaration) {
45436
- var checkMode = declaration.dotDotDotToken ? 32 : 0;
45486
+ var checkMode = declaration.dotDotDotToken ? 64 : 0;
45437
45487
  var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
45438
45488
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
45439
45489
  }
@@ -46069,6 +46119,9 @@ var ts;
46069
46119
  }
46070
46120
  return getWidenedType(getWidenedLiteralType(checkExpression(declaration.statements[0].expression)));
46071
46121
  }
46122
+ if (ts.isAccessor(declaration)) {
46123
+ return getTypeOfAccessors(symbol);
46124
+ }
46072
46125
  if (!pushTypeResolution(symbol, 0)) {
46073
46126
  if (symbol.flags & 512 && !(symbol.flags & 67108864)) {
46074
46127
  return getTypeOfFuncClassEnumModule(symbol);
@@ -46127,9 +46180,6 @@ var ts;
46127
46180
  else if (ts.isEnumMember(declaration)) {
46128
46181
  type = getTypeOfEnumMember(symbol);
46129
46182
  }
46130
- else if (ts.isAccessor(declaration)) {
46131
- type = resolveTypeOfAccessors(symbol) || ts.Debug.fail("Non-write accessor resolution must always produce a type");
46132
- }
46133
46183
  else {
46134
46184
  return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
46135
46185
  }
@@ -46167,81 +46217,58 @@ var ts;
46167
46217
  }
46168
46218
  function getTypeOfAccessors(symbol) {
46169
46219
  var links = getSymbolLinks(symbol);
46170
- return links.type || (links.type = getTypeOfAccessorsWorker(symbol) || ts.Debug.fail("Read type of accessor must always produce a type"));
46171
- }
46172
- function getTypeOfSetAccessor(symbol) {
46173
- var links = getSymbolLinks(symbol);
46174
- return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, true));
46175
- }
46176
- function getTypeOfAccessorsWorker(symbol, writing) {
46177
- if (writing === void 0) { writing = false; }
46178
- if (!pushTypeResolution(symbol, 0)) {
46179
- return errorType;
46180
- }
46181
- var type = resolveTypeOfAccessors(symbol, writing);
46182
- if (!popTypeResolution()) {
46220
+ if (!links.type) {
46221
+ if (!pushTypeResolution(symbol, 0)) {
46222
+ return errorType;
46223
+ }
46183
46224
  var getter = ts.getDeclarationOfKind(symbol, 172);
46184
- if (getter) {
46185
- if (ts.getEffectiveTypeAnnotationNode(getter)) {
46186
- error(getter.name, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
46225
+ var setter = ts.getDeclarationOfKind(symbol, 173);
46226
+ var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) ||
46227
+ getAnnotatedAccessorType(getter) ||
46228
+ getAnnotatedAccessorType(setter) ||
46229
+ getter && getter.body && getReturnTypeFromBody(getter);
46230
+ if (!type) {
46231
+ if (setter && !isPrivateWithinAmbient(setter)) {
46232
+ errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
46233
+ }
46234
+ else if (getter && !isPrivateWithinAmbient(getter)) {
46235
+ errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
46187
46236
  }
46188
- else if (noImplicitAny) {
46237
+ type = anyType;
46238
+ }
46239
+ if (!popTypeResolution()) {
46240
+ if (getAnnotatedAccessorTypeNode(getter)) {
46241
+ error(getter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
46242
+ }
46243
+ else if (getAnnotatedAccessorTypeNode(setter)) {
46244
+ error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
46245
+ }
46246
+ else if (getter && noImplicitAny) {
46189
46247
  error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
46190
46248
  }
46249
+ type = anyType;
46191
46250
  }
46192
- type = anyType;
46251
+ links.type = type;
46193
46252
  }
46194
- return type;
46253
+ return links.type;
46195
46254
  }
46196
- function resolveTypeOfAccessors(symbol, writing) {
46197
- if (writing === void 0) { writing = false; }
46198
- var getter = ts.getDeclarationOfKind(symbol, 172);
46199
- var setter = ts.getDeclarationOfKind(symbol, 173);
46200
- if (writing) {
46201
- var setterType_1 = getAnnotatedAccessorType(setter);
46202
- if (setterType_1) {
46203
- return instantiateTypeIfNeeded(setterType_1, symbol);
46204
- }
46205
- }
46206
- if (getter && ts.isInJSFile(getter)) {
46207
- var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
46208
- if (jsDocType) {
46209
- return instantiateTypeIfNeeded(jsDocType, symbol);
46210
- }
46211
- }
46212
- var getterType = getAnnotatedAccessorType(getter);
46213
- if (getterType) {
46214
- return instantiateTypeIfNeeded(getterType, symbol);
46215
- }
46216
- var setterType = getAnnotatedAccessorType(setter);
46217
- if (setterType) {
46218
- return setterType;
46219
- }
46220
- if (getter && getter.body) {
46221
- var returnTypeFromBody = getReturnTypeFromBody(getter);
46222
- return instantiateTypeIfNeeded(returnTypeFromBody, symbol);
46223
- }
46224
- if (setter) {
46225
- if (!isPrivateWithinAmbient(setter)) {
46226
- errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
46227
- }
46228
- return anyType;
46229
- }
46230
- else if (getter) {
46231
- ts.Debug.assert(!!getter, "there must exist a getter as we are current checking either setter or getter in this function");
46232
- if (!isPrivateWithinAmbient(getter)) {
46233
- errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
46255
+ function getWriteTypeOfAccessors(symbol) {
46256
+ var links = getSymbolLinks(symbol);
46257
+ if (!links.writeType) {
46258
+ if (!pushTypeResolution(symbol, 8)) {
46259
+ return errorType;
46234
46260
  }
46235
- return anyType;
46236
- }
46237
- return undefined;
46238
- function instantiateTypeIfNeeded(type, symbol) {
46239
- if (ts.getCheckFlags(symbol) & 1) {
46240
- var links = getSymbolLinks(symbol);
46241
- return instantiateType(type, links.mapper);
46261
+ var setter = ts.getDeclarationOfKind(symbol, 173);
46262
+ var writeType = getAnnotatedAccessorType(setter);
46263
+ if (!popTypeResolution()) {
46264
+ if (getAnnotatedAccessorTypeNode(setter)) {
46265
+ error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
46266
+ }
46267
+ writeType = anyType;
46242
46268
  }
46243
- return type;
46269
+ links.writeType = writeType || getTypeOfAccessors(symbol);
46244
46270
  }
46271
+ return links.writeType;
46245
46272
  }
46246
46273
  function getBaseTypeVariableOfClass(symbol) {
46247
46274
  var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol));
@@ -46317,17 +46344,11 @@ var ts;
46317
46344
  }
46318
46345
  function getTypeOfInstantiatedSymbol(symbol) {
46319
46346
  var links = getSymbolLinks(symbol);
46320
- if (!links.type) {
46321
- if (!pushTypeResolution(symbol, 0)) {
46322
- return links.type = errorType;
46323
- }
46324
- var type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
46325
- if (!popTypeResolution()) {
46326
- type = reportCircularityError(symbol);
46327
- }
46328
- links.type = type;
46329
- }
46330
- return links.type;
46347
+ return links.type || (links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper));
46348
+ }
46349
+ function getWriteTypeOfInstantiatedSymbol(symbol) {
46350
+ var links = getSymbolLinks(symbol);
46351
+ return links.writeType || (links.writeType = instantiateType(getWriteTypeOfSymbol(links.target), links.mapper));
46331
46352
  }
46332
46353
  function reportCircularityError(symbol) {
46333
46354
  var declaration = symbol.valueDeclaration;
@@ -46360,26 +46381,17 @@ var ts;
46360
46381
  }
46361
46382
  function getWriteTypeOfSymbol(symbol) {
46362
46383
  var checkFlags = ts.getCheckFlags(symbol);
46363
- if (checkFlags & 65536) {
46364
- var writeType = getWriteTypeOfSymbolWithDeferredType(symbol);
46365
- if (writeType) {
46366
- return writeType;
46367
- }
46368
- }
46369
- if (symbol.flags & 33554432) {
46370
- var writeType = symbol.writeType;
46371
- if (writeType) {
46372
- return writeType;
46373
- }
46384
+ if (symbol.flags & 4) {
46385
+ return checkFlags & 2 ?
46386
+ checkFlags & 65536 ?
46387
+ getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) :
46388
+ symbol.writeType || symbol.type :
46389
+ getTypeOfSymbol(symbol);
46374
46390
  }
46375
- return getSetAccessorTypeOfSymbol(symbol);
46376
- }
46377
- function getSetAccessorTypeOfSymbol(symbol) {
46378
46391
  if (symbol.flags & 98304) {
46379
- var type = getTypeOfSetAccessor(symbol);
46380
- if (type) {
46381
- return type;
46382
- }
46392
+ return checkFlags & 1 ?
46393
+ getWriteTypeOfInstantiatedSymbol(symbol) :
46394
+ getWriteTypeOfAccessors(symbol);
46383
46395
  }
46384
46396
  return getTypeOfSymbol(symbol);
46385
46397
  }
@@ -56912,7 +56924,7 @@ var ts;
56912
56924
  for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
56913
56925
  var targetProp = properties_3[_i];
56914
56926
  var sourceProp = getPropertyOfType(source, targetProp.escapedName);
56915
- if (sourceProp) {
56927
+ if (sourceProp && !ts.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
56916
56928
  inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
56917
56929
  }
56918
56930
  }
@@ -59024,7 +59036,7 @@ var ts;
59024
59036
  }
59025
59037
  }
59026
59038
  if (ts.isDeclarationName(location) && ts.isSetAccessor(location.parent) && getAnnotatedAccessorTypeNode(location.parent)) {
59027
- return resolveTypeOfAccessors(location.parent.symbol, true);
59039
+ return getWriteTypeOfAccessors(location.parent.symbol);
59028
59040
  }
59029
59041
  return getNonMissingTypeOfSymbol(symbol);
59030
59042
  }
@@ -59102,7 +59114,7 @@ var ts;
59102
59114
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
59103
59115
  var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
59104
59116
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
59105
- (checkMode && checkMode & 32 ?
59117
+ (checkMode && checkMode & 64 ?
59106
59118
  getContextualType(node, 8)
59107
59119
  : getContextualType(node));
59108
59120
  return contextualType && !isGenericType(contextualType);
@@ -59170,7 +59182,7 @@ var ts;
59170
59182
  if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
59171
59183
  var contextualSignature = getContextualSignature(func);
59172
59184
  if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
59173
- var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
59185
+ var restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
59174
59186
  if (restType.flags & 1048576 && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
59175
59187
  var narrowedType = getFlowTypeOfReference(func, restType, restType, undefined, location.flowNode);
59176
59188
  var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
@@ -59826,7 +59838,7 @@ var ts;
59826
59838
  var parent = declaration.parent.parent;
59827
59839
  var name = declaration.propertyName || declaration.name;
59828
59840
  var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
59829
- parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 : 0);
59841
+ parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
59830
59842
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
59831
59843
  return undefined;
59832
59844
  if (parent.name.kind === 202) {
@@ -60251,7 +60263,10 @@ var ts;
60251
60263
  return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
60252
60264
  }
60253
60265
  if (inferenceContext.returnMapper) {
60254
- 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;
60255
60270
  }
60256
60271
  }
60257
60272
  }
@@ -62424,7 +62439,7 @@ var ts;
62424
62439
  }
62425
62440
  for (var i = 0; i < argCount; i++) {
62426
62441
  var arg = args[i];
62427
- if (arg.kind !== 227) {
62442
+ if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) {
62428
62443
  var paramType = getTypeAtPosition(signature, i);
62429
62444
  var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62430
62445
  inferTypes(context.inferences, argType, paramType);
@@ -63005,7 +63020,7 @@ var ts;
63005
63020
  }
63006
63021
  }
63007
63022
  }
63008
- return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
63023
+ return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
63009
63024
  function addImplementationSuccessElaboration(failed, diagnostic) {
63010
63025
  var _a, _b;
63011
63026
  var oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -63096,11 +63111,11 @@ var ts;
63096
63111
  return undefined;
63097
63112
  }
63098
63113
  }
63099
- function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray) {
63114
+ function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray, checkMode) {
63100
63115
  ts.Debug.assert(candidates.length > 0);
63101
63116
  checkNodeDeferred(node);
63102
63117
  return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function (c) { return !!c.typeParameters; })
63103
- ? pickLongestCandidateSignature(node, candidates, args)
63118
+ ? pickLongestCandidateSignature(node, candidates, args, checkMode)
63104
63119
  : createUnionOfSignaturesForOverloadFailure(candidates);
63105
63120
  }
63106
63121
  function createUnionOfSignaturesForOverloadFailure(candidates) {
@@ -63143,7 +63158,7 @@ var ts;
63143
63158
  function createCombinedSymbolForOverloadFailure(sources, type) {
63144
63159
  return createSymbolWithType(ts.first(sources), type);
63145
63160
  }
63146
- function pickLongestCandidateSignature(node, candidates, args) {
63161
+ function pickLongestCandidateSignature(node, candidates, args, checkMode) {
63147
63162
  var bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args.length : apparentArgumentCount);
63148
63163
  var candidate = candidates[bestIndex];
63149
63164
  var typeParameters = candidate.typeParameters;
@@ -63153,7 +63168,7 @@ var ts;
63153
63168
  var typeArgumentNodes = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments : undefined;
63154
63169
  var instantiated = typeArgumentNodes
63155
63170
  ? createSignatureInstantiation(candidate, getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, ts.isInJSFile(node)))
63156
- : inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args);
63171
+ : inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode);
63157
63172
  candidates[bestIndex] = instantiated;
63158
63173
  return instantiated;
63159
63174
  }
@@ -63167,9 +63182,9 @@ var ts;
63167
63182
  }
63168
63183
  return typeArguments;
63169
63184
  }
63170
- function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args) {
63185
+ function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode) {
63171
63186
  var inferenceContext = createInferenceContext(typeParameters, candidate, ts.isInJSFile(node) ? 2 : 0);
63172
- var typeArgumentTypes = inferTypeArguments(node, candidate, args, 4 | 8, inferenceContext);
63187
+ var typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 | 8, inferenceContext);
63173
63188
  return createSignatureInstantiation(candidate, typeArgumentTypes);
63174
63189
  }
63175
63190
  function getLongestCandidateIndex(candidates, argsCount) {
@@ -68426,7 +68441,7 @@ var ts;
68426
68441
  checkComputedPropertyName(node.propertyName);
68427
68442
  }
68428
68443
  var parent = node.parent.parent;
68429
- var parentCheckMode = node.dotDotDotToken ? 32 : 0;
68444
+ var parentCheckMode = node.dotDotDotToken ? 64 : 0;
68430
68445
  var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
68431
68446
  var name = node.propertyName || node.name;
68432
68447
  if (parentType && !ts.isBindingPattern(name)) {
@@ -68590,6 +68605,8 @@ var ts;
68590
68605
  (condExpr.operatorToken.kind === 56 || condExpr.operatorToken.kind === 55)
68591
68606
  ? condExpr.right
68592
68607
  : condExpr;
68608
+ if (ts.isModuleExportsAccessExpression(location))
68609
+ return;
68593
68610
  var type = checkTruthinessExpression(location);
68594
68611
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
68595
68612
  if (getFalsyFlags(type) || isPropertyExpressionCast)
@@ -96368,6 +96385,13 @@ var ts;
96368
96385
  return "skip";
96369
96386
  }
96370
96387
  break;
96388
+ case 270:
96389
+ case 275:
96390
+ if (node.isTypeOnly) {
96391
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type"));
96392
+ return "skip";
96393
+ }
96394
+ break;
96371
96395
  case 265:
96372
96396
  diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files));
96373
96397
  return "skip";