typescript 4.6.1-rc → 4.6.3

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/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.6";
72
- ts.version = "".concat(ts.versionMajorMinor, ".1-rc");
72
+ ts.version = "4.6.3";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5295,6 +5295,8 @@ var ts;
5295
5295
  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."),
5296
5296
  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."),
5297
5297
  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."),
5298
+ Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
5299
+ Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
5298
5300
  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."),
5299
5301
  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."),
5300
5302
  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."),
@@ -25260,9 +25262,7 @@ var ts;
25260
25262
  return;
25261
25263
  }
25262
25264
  if (initializer) {
25263
- if (token() === 18) {
25264
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25265
- }
25265
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25266
25266
  return;
25267
25267
  }
25268
25268
  parseErrorForMissingSemicolonAfter(name);
@@ -52669,11 +52669,11 @@ var ts;
52669
52669
  var overflow = false;
52670
52670
  var overrideNextErrorInfo = 0;
52671
52671
  var lastSkippedInfo;
52672
- var incompatibleStack = [];
52672
+ var incompatibleStack;
52673
52673
  var inPropertyCheck = false;
52674
52674
  ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
52675
52675
  var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
52676
- if (incompatibleStack.length) {
52676
+ if (incompatibleStack) {
52677
52677
  reportIncompatibleStack();
52678
52678
  }
52679
52679
  if (overflow) {
@@ -52728,19 +52728,19 @@ var ts;
52728
52728
  return {
52729
52729
  errorInfo: errorInfo,
52730
52730
  lastSkippedInfo: lastSkippedInfo,
52731
- incompatibleStack: incompatibleStack.slice(),
52731
+ incompatibleStack: incompatibleStack === null || incompatibleStack === void 0 ? void 0 : incompatibleStack.slice(),
52732
52732
  overrideNextErrorInfo: overrideNextErrorInfo,
52733
- relatedInfo: !relatedInfo ? undefined : relatedInfo.slice()
52733
+ relatedInfo: relatedInfo === null || relatedInfo === void 0 ? void 0 : relatedInfo.slice(),
52734
52734
  };
52735
52735
  }
52736
52736
  function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
52737
52737
  overrideNextErrorInfo++;
52738
52738
  lastSkippedInfo = undefined;
52739
- incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
52739
+ (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
52740
52740
  }
52741
52741
  function reportIncompatibleStack() {
52742
- var stack = incompatibleStack;
52743
- incompatibleStack = [];
52742
+ var stack = incompatibleStack || [];
52743
+ incompatibleStack = undefined;
52744
52744
  var info = lastSkippedInfo;
52745
52745
  lastSkippedInfo = undefined;
52746
52746
  if (stack.length === 1) {
@@ -52834,7 +52834,7 @@ var ts;
52834
52834
  }
52835
52835
  function reportError(message, arg0, arg1, arg2, arg3) {
52836
52836
  ts.Debug.assert(!!errorNode);
52837
- if (incompatibleStack.length)
52837
+ if (incompatibleStack)
52838
52838
  reportIncompatibleStack();
52839
52839
  if (message.elidedInCompatabilityPyramid)
52840
52840
  return;
@@ -52850,7 +52850,7 @@ var ts;
52850
52850
  }
52851
52851
  }
52852
52852
  function reportRelationError(message, source, target) {
52853
- if (incompatibleStack.length)
52853
+ if (incompatibleStack)
52854
52854
  reportIncompatibleStack();
52855
52855
  var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
52856
52856
  var generalizedSource = source;
@@ -52941,7 +52941,9 @@ var ts;
52941
52941
  if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
52942
52942
  return -1;
52943
52943
  }
52944
- reportErrorResults(originalSource, originalTarget, 0, !!(ts.getObjectFlags(originalSource) & 2048));
52944
+ if (reportErrors) {
52945
+ reportErrorResults(originalSource, originalTarget, originalSource, originalTarget, headMessage);
52946
+ }
52945
52947
  return 0;
52946
52948
  }
52947
52949
  var source = getNormalizedType(originalSource, false);
@@ -52949,127 +52951,121 @@ var ts;
52949
52951
  if (source === target)
52950
52952
  return -1;
52951
52953
  if (relation === identityRelation) {
52952
- return isIdenticalTo(source, target, recursionFlags);
52954
+ if (source.flags !== target.flags)
52955
+ return 0;
52956
+ if (source.flags & 67358815)
52957
+ return -1;
52958
+ traceUnionsOrIntersectionsTooLarge(source, target);
52959
+ return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
52953
52960
  }
52954
52961
  if (source.flags & 262144 && getConstraintOfType(source) === target) {
52955
52962
  return -1;
52956
52963
  }
52957
- if (target.flags & 1048576 && source.flags & 524288 &&
52958
- target.types.length <= 3 && maybeTypeOfKind(target, 98304)) {
52959
- var nullStrippedTarget = extractTypesOfKind(target, ~98304);
52960
- if (!(nullStrippedTarget.flags & (1048576 | 131072))) {
52961
- target = getNormalizedType(nullStrippedTarget, true);
52964
+ if (source.flags & 470302716 && target.flags & 1048576) {
52965
+ var types = target.types;
52966
+ var candidate = types.length === 2 && types[0].flags & 98304 ? types[1] :
52967
+ types.length === 3 && types[0].flags & 98304 && types[1].flags & 98304 ? types[2] :
52968
+ undefined;
52969
+ if (candidate && !(candidate.flags & 98304)) {
52970
+ target = getNormalizedType(candidate, true);
52971
+ if (source === target)
52972
+ return -1;
52962
52973
  }
52963
- if (source === nullStrippedTarget)
52964
- return -1;
52965
52974
  }
52966
52975
  if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) ||
52967
52976
  isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
52968
52977
  return -1;
52969
- var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
52970
- var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 16384);
52971
- if (isPerformingExcessPropertyChecks) {
52972
- if (hasExcessProperties(source, target, reportErrors)) {
52978
+ if (source.flags & 469499904 || target.flags & 469499904) {
52979
+ var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 16384);
52980
+ if (isPerformingExcessPropertyChecks) {
52981
+ if (hasExcessProperties(source, target, reportErrors)) {
52982
+ if (reportErrors) {
52983
+ reportRelationError(headMessage, source, originalTarget.aliasSymbol ? originalTarget : target);
52984
+ }
52985
+ return 0;
52986
+ }
52987
+ }
52988
+ var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) &&
52989
+ source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
52990
+ target.flags & (524288 | 2097152) && isWeakType(target) &&
52991
+ (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
52992
+ var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
52993
+ if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
52973
52994
  if (reportErrors) {
52974
- reportRelationError(headMessage, source, originalTarget.aliasSymbol ? originalTarget : target);
52995
+ var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source);
52996
+ var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
52997
+ var calls = getSignaturesOfType(source, 0);
52998
+ var constructs = getSignaturesOfType(source, 1);
52999
+ if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
53000
+ constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
53001
+ reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
53002
+ }
53003
+ else {
53004
+ reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
53005
+ }
52975
53006
  }
52976
53007
  return 0;
52977
53008
  }
52978
- }
52979
- var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) &&
52980
- source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
52981
- target.flags & (524288 | 2097152) && isWeakType(target) &&
52982
- (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
52983
- if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
52984
- if (reportErrors) {
52985
- var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source);
52986
- var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
52987
- var calls = getSignaturesOfType(source, 0);
52988
- var constructs = getSignaturesOfType(source, 1);
52989
- if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
52990
- constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
52991
- reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
52992
- }
52993
- else {
52994
- reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
52995
- }
53009
+ traceUnionsOrIntersectionsTooLarge(source, target);
53010
+ var skipCaching = source.flags & 1048576 && source.types.length < 4 && !(target.flags & 1048576) ||
53011
+ target.flags & 1048576 && target.types.length < 4 && !(source.flags & 469499904);
53012
+ var result_7 = skipCaching ?
53013
+ unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
53014
+ recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
53015
+ if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
53016
+ isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
53017
+ inPropertyCheck = true;
53018
+ result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
53019
+ inPropertyCheck = false;
52996
53020
  }
52997
- return 0;
52998
- }
52999
- traceUnionsOrIntersectionsTooLarge(source, target);
53000
- var result = 0;
53001
- var saveErrorInfo = captureErrorCalculationState();
53002
- if ((source.flags & 1048576 || target.flags & 1048576) && getConstituentCount(source) * getConstituentCount(target) < 4) {
53003
- result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
53004
- }
53005
- else if (source.flags & 3145728 || target.flags & 3145728) {
53006
- result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags);
53007
- }
53008
- if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
53009
- if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
53010
- resetErrorInfo(saveErrorInfo);
53021
+ if (result_7) {
53022
+ return result_7;
53011
53023
  }
53012
53024
  }
53013
- if (!result && source.flags & (2097152 | 262144)) {
53014
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
53015
- if (constraint && (source.flags & 2097152 || target.flags & 1048576)) {
53016
- if (everyType(constraint, function (c) { return c !== source; })) {
53017
- if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
53018
- resetErrorInfo(saveErrorInfo);
53019
- }
53020
- }
53025
+ if (reportErrors) {
53026
+ reportErrorResults(originalSource, originalTarget, source, target, headMessage);
53027
+ }
53028
+ return 0;
53029
+ }
53030
+ function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
53031
+ var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
53032
+ var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
53033
+ source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
53034
+ target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
53035
+ var maybeSuppress = overrideNextErrorInfo > 0;
53036
+ if (maybeSuppress) {
53037
+ overrideNextErrorInfo--;
53038
+ }
53039
+ if (source.flags & 524288 && target.flags & 524288) {
53040
+ var currentError = errorInfo;
53041
+ tryElaborateArrayLikeErrors(source, target, true);
53042
+ if (errorInfo !== currentError) {
53043
+ maybeSuppress = !!errorInfo;
53044
+ }
53045
+ }
53046
+ if (source.flags & 524288 && target.flags & 131068) {
53047
+ tryElaborateErrorsForPrimitivesAndObjects(source, target);
53048
+ }
53049
+ else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
53050
+ reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
53051
+ }
53052
+ else if (ts.getObjectFlags(source) & 2048 && target.flags & 2097152) {
53053
+ var targetTypes = target.types;
53054
+ var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
53055
+ var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
53056
+ if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
53057
+ (ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
53058
+ return;
53021
53059
  }
53022
53060
  }
53023
- if (result && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
53024
- isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
53025
- inPropertyCheck = true;
53026
- result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
53027
- inPropertyCheck = false;
53061
+ else {
53062
+ errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
53028
53063
  }
53029
- reportErrorResults(source, target, result, isComparingJsxAttributes);
53030
- return result;
53031
- function reportErrorResults(source, target, result, isComparingJsxAttributes) {
53032
- if (!result && reportErrors) {
53033
- var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
53034
- var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
53035
- source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
53036
- target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
53037
- var maybeSuppress = overrideNextErrorInfo > 0;
53038
- if (maybeSuppress) {
53039
- overrideNextErrorInfo--;
53040
- }
53041
- if (source.flags & 524288 && target.flags & 524288) {
53042
- var currentError = errorInfo;
53043
- tryElaborateArrayLikeErrors(source, target, reportErrors);
53044
- if (errorInfo !== currentError) {
53045
- maybeSuppress = !!errorInfo;
53046
- }
53047
- }
53048
- if (source.flags & 524288 && target.flags & 131068) {
53049
- tryElaborateErrorsForPrimitivesAndObjects(source, target);
53050
- }
53051
- else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
53052
- reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
53053
- }
53054
- else if (isComparingJsxAttributes && target.flags & 2097152) {
53055
- var targetTypes = target.types;
53056
- var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
53057
- var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
53058
- if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
53059
- (ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
53060
- return result;
53061
- }
53062
- }
53063
- else {
53064
- errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
53065
- }
53066
- if (!headMessage && maybeSuppress) {
53067
- lastSkippedInfo = [source, target];
53068
- return result;
53069
- }
53070
- reportRelationError(headMessage, source, target);
53071
- }
53064
+ if (!headMessage && maybeSuppress) {
53065
+ lastSkippedInfo = [source, target];
53066
+ return;
53072
53067
  }
53068
+ reportRelationError(headMessage, source, target);
53073
53069
  }
53074
53070
  function traceUnionsOrIntersectionsTooLarge(source, target) {
53075
53071
  if (!ts.tracing) {
@@ -53095,21 +53091,6 @@ var ts;
53095
53091
  }
53096
53092
  }
53097
53093
  }
53098
- function isIdenticalTo(source, target, recursionFlags) {
53099
- if (source.flags !== target.flags)
53100
- return 0;
53101
- if (source.flags & 67358815)
53102
- return -1;
53103
- traceUnionsOrIntersectionsTooLarge(source, target);
53104
- if (source.flags & 3145728) {
53105
- var result_7 = eachTypeRelatedToSomeType(source, target);
53106
- if (result_7) {
53107
- result_7 &= eachTypeRelatedToSomeType(target, source);
53108
- }
53109
- return result_7;
53110
- }
53111
- return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
53112
- }
53113
53094
  function getTypeOfPropertyInTypes(types, name) {
53114
53095
  var appendPropType = function (propTypes, type) {
53115
53096
  var _a;
@@ -53198,6 +53179,29 @@ var ts;
53198
53179
  function shouldCheckAsExcessProperty(prop, container) {
53199
53180
  return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
53200
53181
  }
53182
+ function unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) {
53183
+ if (source.flags & 1048576) {
53184
+ return relation === comparableRelation ?
53185
+ someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState) :
53186
+ eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState);
53187
+ }
53188
+ if (target.flags & 1048576) {
53189
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
53190
+ }
53191
+ if (target.flags & 2097152) {
53192
+ return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2);
53193
+ }
53194
+ if (relation === comparableRelation && target.flags & 131068) {
53195
+ var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
53196
+ if (constraints !== source.types) {
53197
+ source = getIntersectionType(constraints);
53198
+ if (!(source.flags & 2097152)) {
53199
+ return isRelatedTo(source, target, 1, false);
53200
+ }
53201
+ }
53202
+ }
53203
+ return someTypeRelatedToType(source, target, false, 1);
53204
+ }
53201
53205
  function eachTypeRelatedToSomeType(source, target) {
53202
53206
  var result = -1;
53203
53207
  var sourceTypes = source.types;
@@ -53234,7 +53238,9 @@ var ts;
53234
53238
  }
53235
53239
  if (reportErrors) {
53236
53240
  var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
53237
- isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], 2, true);
53241
+ if (bestMatchingType) {
53242
+ isRelatedTo(source, bestMatchingType, 2, true);
53243
+ }
53238
53244
  }
53239
53245
  return 0;
53240
53246
  }
@@ -53342,7 +53348,7 @@ var ts;
53342
53348
  if (overflow) {
53343
53349
  return 0;
53344
53350
  }
53345
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 : 0);
53351
+ var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 : 0);
53346
53352
  var id = getRelationKey(source, target, keyIntersectionState, relation, false);
53347
53353
  var entry = relation.get(id);
53348
53354
  if (entry !== undefined) {
@@ -53403,6 +53409,7 @@ var ts;
53403
53409
  return originalHandler(onlyUnreliable);
53404
53410
  };
53405
53411
  }
53412
+ var result;
53406
53413
  if (expandingFlags === 3) {
53407
53414
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", {
53408
53415
  sourceId: source.id,
@@ -53412,8 +53419,13 @@ var ts;
53412
53419
  depth: sourceDepth,
53413
53420
  targetDepth: targetDepth
53414
53421
  });
53422
+ result = 3;
53423
+ }
53424
+ else {
53425
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
53426
+ result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState);
53427
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
53415
53428
  }
53416
- var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
53417
53429
  if (outofbandVarianceMarkerHandler) {
53418
53430
  outofbandVarianceMarkerHandler = originalHandler;
53419
53431
  }
@@ -53441,74 +53453,73 @@ var ts;
53441
53453
  return result;
53442
53454
  }
53443
53455
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
53444
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
53445
- var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
53446
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
53447
- return result;
53448
- }
53449
- function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
53450
53456
  if (intersectionState & 4) {
53451
53457
  return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
53452
53458
  }
53453
- if (intersectionState & 8) {
53454
- if (source.flags & 1048576) {
53455
- return relation === comparableRelation ?
53456
- someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState & ~8) :
53457
- eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState & ~8);
53458
- }
53459
- if (target.flags & 1048576) {
53460
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
53461
- }
53462
- if (target.flags & 2097152) {
53463
- return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2);
53464
- }
53465
- if (relation === comparableRelation && target.flags & 131068) {
53466
- var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
53467
- if (constraints !== source.types) {
53468
- source = getIntersectionType(constraints);
53469
- if (!(source.flags & 2097152)) {
53470
- return isRelatedTo(source, target, 1, false);
53471
- }
53459
+ var result;
53460
+ var originalErrorInfo;
53461
+ var varianceCheckFailed = false;
53462
+ var saveErrorInfo = captureErrorCalculationState();
53463
+ var sourceFlags = source.flags;
53464
+ var targetFlags = target.flags;
53465
+ if (relation === identityRelation) {
53466
+ if (sourceFlags & 3145728) {
53467
+ var result_8 = eachTypeRelatedToSomeType(source, target);
53468
+ if (result_8) {
53469
+ result_8 &= eachTypeRelatedToSomeType(target, source);
53472
53470
  }
53471
+ return result_8;
53473
53472
  }
53474
- return someTypeRelatedToType(source, target, false, 1);
53475
- }
53476
- var flags = source.flags & target.flags;
53477
- if (relation === identityRelation && !(flags & 524288)) {
53478
- if (flags & 4194304) {
53473
+ if (sourceFlags & 4194304) {
53479
53474
  return isRelatedTo(source.type, target.type, 3, false);
53480
53475
  }
53481
- var result_8 = 0;
53482
- if (flags & 8388608) {
53483
- if (result_8 = isRelatedTo(source.objectType, target.objectType, 3, false)) {
53484
- if (result_8 &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
53485
- return result_8;
53476
+ if (sourceFlags & 8388608) {
53477
+ if (result = isRelatedTo(source.objectType, target.objectType, 3, false)) {
53478
+ if (result &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
53479
+ return result;
53486
53480
  }
53487
53481
  }
53488
53482
  }
53489
- if (flags & 16777216) {
53483
+ if (sourceFlags & 16777216) {
53490
53484
  if (source.root.isDistributive === target.root.isDistributive) {
53491
- if (result_8 = isRelatedTo(source.checkType, target.checkType, 3, false)) {
53492
- if (result_8 &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
53493
- if (result_8 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
53494
- if (result_8 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
53495
- return result_8;
53485
+ if (result = isRelatedTo(source.checkType, target.checkType, 3, false)) {
53486
+ if (result &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
53487
+ if (result &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
53488
+ if (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
53489
+ return result;
53496
53490
  }
53497
53491
  }
53498
53492
  }
53499
53493
  }
53500
53494
  }
53501
53495
  }
53502
- if (flags & 33554432) {
53496
+ if (sourceFlags & 33554432) {
53503
53497
  return isRelatedTo(source.substitute, target.substitute, 3, false);
53504
53498
  }
53505
- return 0;
53499
+ if (!(sourceFlags & 524288)) {
53500
+ return 0;
53501
+ }
53506
53502
  }
53507
- var result;
53508
- var originalErrorInfo;
53509
- var varianceCheckFailed = false;
53510
- var saveErrorInfo = captureErrorCalculationState();
53511
- if (source.flags & (524288 | 16777216) && source.aliasSymbol &&
53503
+ else if (sourceFlags & 3145728 || targetFlags & 3145728) {
53504
+ if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
53505
+ return result;
53506
+ }
53507
+ if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
53508
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
53509
+ if (constraint && everyType(constraint, function (c) { return c !== source; })) {
53510
+ if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
53511
+ resetErrorInfo(saveErrorInfo);
53512
+ return result;
53513
+ }
53514
+ }
53515
+ }
53516
+ if (!(sourceFlags & 465829888 ||
53517
+ sourceFlags & 524288 && targetFlags & 1048576 ||
53518
+ sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
53519
+ return 0;
53520
+ }
53521
+ }
53522
+ if (sourceFlags & (524288 | 16777216) && source.aliasSymbol &&
53512
53523
  source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
53513
53524
  !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
53514
53525
  var variances = getAliasVariances(source.aliasSymbol);
@@ -53524,7 +53535,7 @@ var ts;
53524
53535
  isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
53525
53536
  return result;
53526
53537
  }
53527
- if (target.flags & 262144) {
53538
+ if (targetFlags & 262144) {
53528
53539
  if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
53529
53540
  if (!(getMappedTypeModifiers(source) & 4)) {
53530
53541
  var templateType = getTemplateTypeFromMappedType(source);
@@ -53535,9 +53546,9 @@ var ts;
53535
53546
  }
53536
53547
  }
53537
53548
  }
53538
- else if (target.flags & 4194304) {
53549
+ else if (targetFlags & 4194304) {
53539
53550
  var targetType_1 = target.type;
53540
- if (source.flags & 4194304) {
53551
+ if (sourceFlags & 4194304) {
53541
53552
  if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
53542
53553
  return result;
53543
53554
  }
@@ -53573,8 +53584,8 @@ var ts;
53573
53584
  }
53574
53585
  }
53575
53586
  }
53576
- else if (target.flags & 8388608) {
53577
- if (source.flags & 8388608) {
53587
+ else if (targetFlags & 8388608) {
53588
+ if (sourceFlags & 8388608) {
53578
53589
  if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
53579
53590
  result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
53580
53591
  }
@@ -53653,7 +53664,7 @@ var ts;
53653
53664
  }
53654
53665
  }
53655
53666
  }
53656
- else if (target.flags & 16777216) {
53667
+ else if (targetFlags & 16777216) {
53657
53668
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
53658
53669
  resetErrorInfo(saveErrorInfo);
53659
53670
  return 3;
@@ -53671,8 +53682,8 @@ var ts;
53671
53682
  }
53672
53683
  }
53673
53684
  }
53674
- else if (target.flags & 134217728) {
53675
- if (source.flags & 134217728) {
53685
+ else if (targetFlags & 134217728) {
53686
+ if (sourceFlags & 134217728) {
53676
53687
  if (relation === comparableRelation) {
53677
53688
  return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
53678
53689
  }
@@ -53682,10 +53693,10 @@ var ts;
53682
53693
  return -1;
53683
53694
  }
53684
53695
  }
53685
- if (source.flags & 8650752) {
53686
- if (!(source.flags & 8388608 && target.flags & 8388608)) {
53696
+ if (sourceFlags & 8650752) {
53697
+ if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
53687
53698
  var constraint = getConstraintOfType(source);
53688
- if (!constraint || (source.flags & 262144 && constraint.flags & 1)) {
53699
+ if (!constraint || (sourceFlags & 262144 && constraint.flags & 1)) {
53689
53700
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
53690
53701
  resetErrorInfo(saveErrorInfo);
53691
53702
  return result;
@@ -53695,7 +53706,7 @@ var ts;
53695
53706
  resetErrorInfo(saveErrorInfo);
53696
53707
  return result;
53697
53708
  }
53698
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(target.flags & source.flags & 262144), undefined, intersectionState)) {
53709
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
53699
53710
  resetErrorInfo(saveErrorInfo);
53700
53711
  return result;
53701
53712
  }
@@ -53710,14 +53721,14 @@ var ts;
53710
53721
  }
53711
53722
  }
53712
53723
  }
53713
- else if (source.flags & 4194304) {
53724
+ else if (sourceFlags & 4194304) {
53714
53725
  if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
53715
53726
  resetErrorInfo(saveErrorInfo);
53716
53727
  return result;
53717
53728
  }
53718
53729
  }
53719
- else if (source.flags & 134217728 && !(target.flags & 524288)) {
53720
- if (!(target.flags & 134217728)) {
53730
+ else if (sourceFlags & 134217728 && !(targetFlags & 524288)) {
53731
+ if (!(targetFlags & 134217728)) {
53721
53732
  var constraint = getBaseConstraintOfType(source);
53722
53733
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
53723
53734
  resetErrorInfo(saveErrorInfo);
@@ -53725,8 +53736,8 @@ var ts;
53725
53736
  }
53726
53737
  }
53727
53738
  }
53728
- else if (source.flags & 268435456) {
53729
- if (target.flags & 268435456 && source.symbol === target.symbol) {
53739
+ else if (sourceFlags & 268435456) {
53740
+ if (targetFlags & 268435456 && source.symbol === target.symbol) {
53730
53741
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
53731
53742
  resetErrorInfo(saveErrorInfo);
53732
53743
  return result;
@@ -53740,12 +53751,12 @@ var ts;
53740
53751
  }
53741
53752
  }
53742
53753
  }
53743
- else if (source.flags & 16777216) {
53754
+ else if (sourceFlags & 16777216) {
53744
53755
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
53745
53756
  resetErrorInfo(saveErrorInfo);
53746
53757
  return 3;
53747
53758
  }
53748
- if (target.flags & 16777216) {
53759
+ if (targetFlags & 16777216) {
53749
53760
  var sourceParams = source.root.inferTypeParameters;
53750
53761
  var sourceExtends = source.extendsType;
53751
53762
  var mapper = void 0;
@@ -53796,9 +53807,10 @@ var ts;
53796
53807
  }
53797
53808
  return 0;
53798
53809
  }
53799
- var sourceIsPrimitive = !!(source.flags & 131068);
53810
+ var sourceIsPrimitive = !!(sourceFlags & 131068);
53800
53811
  if (relation !== identityRelation) {
53801
53812
  source = getApparentType(source);
53813
+ sourceFlags = source.flags;
53802
53814
  }
53803
53815
  else if (isGenericMappedType(source)) {
53804
53816
  return 0;
@@ -53825,7 +53837,7 @@ var ts;
53825
53837
  else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target) && ts.getObjectFlags(target) & 16384 && !isEmptyObjectType(source)) {
53826
53838
  return 0;
53827
53839
  }
53828
- if (source.flags & (524288 | 2097152) && target.flags & 524288) {
53840
+ if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) {
53829
53841
  var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
53830
53842
  result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, intersectionState);
53831
53843
  if (result) {
@@ -53844,7 +53856,7 @@ var ts;
53844
53856
  return result;
53845
53857
  }
53846
53858
  }
53847
- if (source.flags & (524288 | 2097152) && target.flags & 1048576) {
53859
+ if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) {
53848
53860
  var objectOnlyTarget = extractTypesOfKind(target, 524288 | 2097152 | 33554432);
53849
53861
  if (objectOnlyTarget.flags & 1048576) {
53850
53862
  var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
@@ -54290,7 +54302,6 @@ var ts;
54290
54302
  }
54291
54303
  }
54292
54304
  var result = -1;
54293
- var saveErrorInfo = captureErrorCalculationState();
54294
54305
  var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
54295
54306
  var sourceObjectFlags = ts.getObjectFlags(source);
54296
54307
  var targetObjectFlags = ts.getObjectFlags(target);
@@ -54322,6 +54333,7 @@ var ts;
54322
54333
  else {
54323
54334
  outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {
54324
54335
  var t = targetSignatures_1[_i];
54336
+ var saveErrorInfo = captureErrorCalculationState();
54325
54337
  var shouldElaborateErrors = reportErrors;
54326
54338
  for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) {
54327
54339
  var s = sourceSignatures_1[_c];
@@ -57110,9 +57122,6 @@ var ts;
57110
57122
  getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
57111
57123
  mapType(type, mapper);
57112
57124
  }
57113
- function getConstituentCount(type) {
57114
- return type.flags & 1048576 ? type.types.length : 1;
57115
- }
57116
57125
  function extractTypesOfKind(type, kind) {
57117
57126
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
57118
57127
  }
@@ -58457,7 +58466,7 @@ var ts;
58457
58466
  var substituteConstraints = !(checkMode && checkMode & 2) &&
58458
58467
  someType(type, isGenericTypeWithUnionConstraint) &&
58459
58468
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
58460
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
58469
+ return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
58461
58470
  }
58462
58471
  function isExportOrExportExpression(location) {
58463
58472
  return !!ts.findAncestor(location, function (n) {
@@ -58503,6 +58512,9 @@ var ts;
58503
58512
  if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
58504
58513
  var pattern = declaration.parent;
58505
58514
  var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode);
58515
+ if (narrowedType.flags & 131072) {
58516
+ return neverType;
58517
+ }
58506
58518
  return getBindingElementTypeFromParentType(declaration, narrowedType);
58507
58519
  }
58508
58520
  }
@@ -63621,19 +63633,20 @@ var ts;
63621
63633
  if (links.type === unknownType) {
63622
63634
  links.type = getTypeFromBindingPattern(declaration.name);
63623
63635
  }
63624
- assignBindingElementTypes(declaration.name);
63636
+ assignBindingElementTypes(declaration.name, links.type);
63625
63637
  }
63626
63638
  }
63627
63639
  }
63628
- function assignBindingElementTypes(pattern) {
63640
+ function assignBindingElementTypes(pattern, parentType) {
63629
63641
  for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
63630
63642
  var element = _a[_i];
63631
63643
  if (!ts.isOmittedExpression(element)) {
63644
+ var type = getBindingElementTypeFromParentType(element, parentType);
63632
63645
  if (element.name.kind === 79) {
63633
- getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
63646
+ getSymbolLinks(getSymbolOfNode(element)).type = type;
63634
63647
  }
63635
63648
  else {
63636
- assignBindingElementTypes(element.name);
63649
+ assignBindingElementTypes(element.name, type);
63637
63650
  }
63638
63651
  }
63639
63652
  }
@@ -66828,26 +66841,24 @@ var ts;
66828
66841
  if (returnType.flags & 1) {
66829
66842
  return;
66830
66843
  }
66844
+ var headMessage;
66831
66845
  var expectedReturnType;
66832
- var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
66833
- var errorInfo;
66834
66846
  switch (node.parent.kind) {
66835
66847
  case 256:
66848
+ headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
66836
66849
  var classSymbol = getSymbolOfNode(node.parent);
66837
66850
  var classConstructorType = getTypeOfSymbol(classSymbol);
66838
66851
  expectedReturnType = getUnionType([classConstructorType, voidType]);
66839
66852
  break;
66840
- case 163:
66841
- expectedReturnType = voidType;
66842
- errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
66843
- break;
66844
66853
  case 166:
66854
+ case 163:
66855
+ headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
66845
66856
  expectedReturnType = voidType;
66846
- errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
66847
66857
  break;
66848
66858
  case 168:
66849
66859
  case 171:
66850
66860
  case 172:
66861
+ headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
66851
66862
  var methodType = getTypeOfNode(node.parent);
66852
66863
  var descriptorType = createTypedPropertyDescriptorType(methodType);
66853
66864
  expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -66855,7 +66866,7 @@ var ts;
66855
66866
  default:
66856
66867
  return ts.Debug.fail();
66857
66868
  }
66858
- checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, function () { return errorInfo; });
66869
+ checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
66859
66870
  }
66860
66871
  function markTypeNodeAsReferenced(node) {
66861
66872
  markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
@@ -68716,9 +68727,9 @@ var ts;
68716
68727
  var containsArguments = containsArgumentsReference(node);
68717
68728
  if (containsArguments) {
68718
68729
  var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
68719
- if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
68730
+ if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
68720
68731
  lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
68721
- 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));
68732
+ error(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));
68722
68733
  }
68723
68734
  }
68724
68735
  else {
@@ -68728,7 +68739,9 @@ var ts;
68728
68739
  return;
68729
68740
  }
68730
68741
  if (ts.isQualifiedName(name)) {
68731
- errorOrSuggestion(isJs, name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
68742
+ if (isJs) {
68743
+ error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
68744
+ }
68732
68745
  }
68733
68746
  else {
68734
68747
  errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
@@ -73424,24 +73437,23 @@ var ts;
73424
73437
  }
73425
73438
  function findMostOverlappyType(source, unionTarget) {
73426
73439
  var bestMatch;
73427
- var matchingCount = 0;
73428
- for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
73429
- var target = _a[_i];
73430
- var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
73431
- if (overlap.flags & 4194304) {
73432
- bestMatch = target;
73433
- matchingCount = Infinity;
73434
- }
73435
- else if (overlap.flags & 1048576) {
73436
- var len = ts.length(ts.filter(overlap.types, isUnitType));
73437
- if (len >= matchingCount) {
73438
- bestMatch = target;
73439
- matchingCount = len;
73440
- }
73441
- }
73442
- else if (isUnitType(overlap) && 1 >= matchingCount) {
73443
- bestMatch = target;
73444
- matchingCount = 1;
73440
+ if (!(source.flags & (131068 | 406847488))) {
73441
+ var matchingCount = 0;
73442
+ for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
73443
+ var target = _a[_i];
73444
+ if (!(target.flags & (131068 | 406847488))) {
73445
+ var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
73446
+ if (overlap.flags & 4194304) {
73447
+ return target;
73448
+ }
73449
+ else if (isUnitType(overlap) || overlap.flags & 1048576) {
73450
+ var len = overlap.flags & 1048576 ? ts.countWhere(overlap.types, isUnitType) : 1;
73451
+ if (len >= matchingCount) {
73452
+ bestMatch = target;
73453
+ matchingCount = len;
73454
+ }
73455
+ }
73456
+ }
73445
73457
  }
73446
73458
  }
73447
73459
  return bestMatch;