typescript 4.8.0-dev.20220509 → 4.8.0-dev.20220510

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.
@@ -28,9 +28,13 @@ declare namespace Intl {
28
28
  fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
29
29
  }
30
30
 
31
+ interface DateTimeRangeFormatPart extends DateTimeFormatPart {
32
+ source: "startRange" | "endRange" | "shared"
33
+ }
34
+
31
35
  interface DateTimeFormat {
32
36
  formatRange(startDate: Date | number | bigint, endDate: Date | number | bigint): string;
33
- formatRangeToParts(startDate: Date | number | bigint, endDate: Date | number | bigint): DateTimeFormatPart[];
37
+ formatRangeToParts(startDate: Date | number | bigint, endDate: Date | number | bigint): DateTimeRangeFormatPart[];
34
38
  }
35
39
 
36
40
  interface ResolvedDateTimeFormatOptions {
@@ -39,7 +43,7 @@ declare namespace Intl {
39
43
  timeStyle?: "full" | "long" | "medium" | "short";
40
44
  hourCycle?: "h11" | "h12" | "h23" | "h24";
41
45
  dayPeriod?: "narrow" | "short" | "long";
42
- fractionalSecondDigits?: 0 | 1 | 2 | 3;
46
+ fractionalSecondDigits?: 1 | 2 | 3;
43
47
  }
44
48
 
45
49
  /**
@@ -19,8 +19,12 @@ and limitations under the License.
19
19
 
20
20
 
21
21
  declare namespace Intl {
22
+ interface NumberRangeFormatPart extends NumberFormatPart {
23
+ source: "startRange" | "endRange" | "shared"
24
+ }
25
+
22
26
  interface NumberFormat {
23
27
  formatRange(start: number | bigint, end: number | bigint): string;
24
- formatRangeToParts(start: number | bigint, end: number | bigint): NumberFormatPart[];
28
+ formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[];
25
29
  }
26
30
  }
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.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220509";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220510";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -10664,6 +10664,16 @@ var ts;
10664
10664
  return node.kind === 324 || node.kind === 325 || node.kind === 326;
10665
10665
  }
10666
10666
  ts.isJSDocLinkLike = isJSDocLinkLike;
10667
+ function hasRestParameter(s) {
10668
+ var last = ts.lastOrUndefined(s.parameters);
10669
+ return !!last && isRestParameter(last);
10670
+ }
10671
+ ts.hasRestParameter = hasRestParameter;
10672
+ function isRestParameter(node) {
10673
+ var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
10674
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 318;
10675
+ }
10676
+ ts.isRestParameter = isRestParameter;
10667
10677
  })(ts || (ts = {}));
10668
10678
  var ts;
10669
10679
  (function (ts) {
@@ -13158,16 +13168,6 @@ var ts;
13158
13168
  return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
13159
13169
  }
13160
13170
  ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc;
13161
- function hasRestParameter(s) {
13162
- var last = ts.lastOrUndefined(s.parameters);
13163
- return !!last && isRestParameter(last);
13164
- }
13165
- ts.hasRestParameter = hasRestParameter;
13166
- function isRestParameter(node) {
13167
- var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
13168
- return node.dotDotDotToken !== undefined || !!type && type.kind === 318;
13169
- }
13170
- ts.isRestParameter = isRestParameter;
13171
13171
  function hasTypeArguments(node) {
13172
13172
  return !!node.typeArguments;
13173
13173
  }
@@ -54508,6 +54508,18 @@ var ts;
54508
54508
  }
54509
54509
  }
54510
54510
  }
54511
+ if (relation === comparableRelation && sourceFlags & 262144) {
54512
+ var constraint = getConstraintOfTypeParameter(source);
54513
+ if (constraint && hasNonCircularBaseConstraint(source)) {
54514
+ while (constraint && constraint.flags & 262144) {
54515
+ if (result = isRelatedTo(constraint, target, 1, false)) {
54516
+ return result;
54517
+ }
54518
+ constraint = getConstraintOfTypeParameter(constraint);
54519
+ }
54520
+ }
54521
+ return 0;
54522
+ }
54511
54523
  }
54512
54524
  else if (targetFlags & 4194304) {
54513
54525
  var targetType_1 = target.type;
@@ -54658,18 +54670,18 @@ var ts;
54658
54670
  }
54659
54671
  if (sourceFlags & 8650752) {
54660
54672
  if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
54661
- var constraint = getConstraintOfType(source);
54662
- if (!constraint || (sourceFlags & 262144 && constraint.flags & 1)) {
54673
+ var constraint = getConstraintOfType(source) || unknownType;
54674
+ if (!getConstraintOfType(source) || (sourceFlags & 262144 && constraint.flags & 1)) {
54663
54675
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
54664
54676
  resetErrorInfo(saveErrorInfo);
54665
54677
  return result;
54666
54678
  }
54667
54679
  }
54668
- else if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
54680
+ if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
54669
54681
  resetErrorInfo(saveErrorInfo);
54670
54682
  return result;
54671
54683
  }
54672
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
54684
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
54673
54685
  resetErrorInfo(saveErrorInfo);
54674
54686
  return result;
54675
54687
  }
@@ -60523,7 +60535,25 @@ var ts;
60523
60535
  }
60524
60536
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
60525
60537
  return mapType(type, function (t) {
60526
- var _a;
60538
+ if (t.flags & 2097152) {
60539
+ var intersection = t;
60540
+ var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
60541
+ if (newTypes.length > 0) {
60542
+ return getIntersectionType(newTypes);
60543
+ }
60544
+ newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
60545
+ if (newTypes.length > 0) {
60546
+ return getIntersectionType(newTypes);
60547
+ }
60548
+ return undefined;
60549
+ }
60550
+ var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
60551
+ if (concretePropertyType) {
60552
+ return concretePropertyType;
60553
+ }
60554
+ return getTypeOfApplicableIndexInfoOfContextualType(t);
60555
+ }, true);
60556
+ function getTypeOfConcretePropertyOfContextualType(t) {
60527
60557
  if (isGenericMappedType(t) && !t.declaration.nameType) {
60528
60558
  var constraint = getConstraintTypeFromMappedType(t);
60529
60559
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
@@ -60531,8 +60561,9 @@ var ts;
60531
60561
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
60532
60562
  return substituteIndexedMappedType(t, propertyNameType);
60533
60563
  }
60564
+ return undefined;
60534
60565
  }
60535
- else if (t.flags & 3670016) {
60566
+ if (t.flags & 3670016) {
60536
60567
  var prop = getPropertyOfType(t, name);
60537
60568
  if (prop) {
60538
60569
  return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
@@ -60543,10 +60574,16 @@ var ts;
60543
60574
  return restType;
60544
60575
  }
60545
60576
  }
60546
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
60547
60577
  }
60548
60578
  return undefined;
60549
- }, true);
60579
+ }
60580
+ function getTypeOfApplicableIndexInfoOfContextualType(t) {
60581
+ var _a;
60582
+ if (!(t.flags & 3670016)) {
60583
+ return undefined;
60584
+ }
60585
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
60586
+ }
60550
60587
  }
60551
60588
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
60552
60589
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
@@ -67924,7 +67961,7 @@ var ts;
67924
67961
  var promisedType = getPromisedTypeOfPromise(type, errorNode);
67925
67962
  return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0);
67926
67963
  }
67927
- function getPromisedTypeOfPromise(type, errorNode) {
67964
+ function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
67928
67965
  if (isTypeAny(type)) {
67929
67966
  return undefined;
67930
67967
  }
@@ -67949,7 +67986,29 @@ var ts;
67949
67986
  }
67950
67987
  return undefined;
67951
67988
  }
67952
- var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 2097152);
67989
+ var thisTypeForError;
67990
+ var candidates;
67991
+ for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) {
67992
+ var thenSignature = thenSignatures_1[_i];
67993
+ var thisType = getThisTypeOfSignature(thenSignature);
67994
+ if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) {
67995
+ thisTypeForError = thisType;
67996
+ }
67997
+ else {
67998
+ candidates = ts.append(candidates, thenSignature);
67999
+ }
68000
+ }
68001
+ if (!candidates) {
68002
+ ts.Debug.assertIsDefined(thisTypeForError);
68003
+ if (thisTypeForErrorOut) {
68004
+ thisTypeForErrorOut.value = thisTypeForError;
68005
+ }
68006
+ if (errorNode) {
68007
+ error(errorNode, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
68008
+ }
68009
+ return undefined;
68010
+ }
68011
+ var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(candidates, getTypeOfFirstParameterOfSignature)), 2097152);
67953
68012
  if (isTypeAny(onfulfilledParameterType)) {
67954
68013
  return undefined;
67955
68014
  }
@@ -68026,7 +68085,8 @@ var ts;
68026
68085
  var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
68027
68086
  return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
68028
68087
  }
68029
- var promisedType = getPromisedTypeOfPromise(type);
68088
+ var thisTypeForErrorOut = { value: undefined };
68089
+ var promisedType = getPromisedTypeOfPromise(type, undefined, thisTypeForErrorOut);
68030
68090
  if (promisedType) {
68031
68091
  if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
68032
68092
  if (errorNode) {
@@ -68045,7 +68105,12 @@ var ts;
68045
68105
  if (isThenableType(type)) {
68046
68106
  if (errorNode) {
68047
68107
  ts.Debug.assertIsDefined(diagnosticMessage);
68048
- error(errorNode, diagnosticMessage, arg0);
68108
+ var chain = void 0;
68109
+ if (thisTypeForErrorOut.value) {
68110
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
68111
+ }
68112
+ chain = ts.chainDiagnosticMessages(chain, diagnosticMessage, arg0);
68113
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, chain));
68049
68114
  }
68050
68115
  return undefined;
68051
68116
  }
@@ -101158,6 +101223,8 @@ var ts;
101158
101223
  if (ts.fileExtensionIsOneOf(fileName, [".json", ".mjs", ".cjs"]))
101159
101224
  return fileName;
101160
101225
  var noExtension = ts.removeFileExtension(fileName);
101226
+ if (fileName === noExtension)
101227
+ return fileName;
101161
101228
  if (ts.fileExtensionIsOneOf(fileName, [".d.mts", ".mts", ".d.cts", ".cts"]))
101162
101229
  return noExtension + getJSExtensionForFile(fileName, options);
101163
101230
  switch (ending) {
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20220509";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220510";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -14073,6 +14073,16 @@ var ts;
14073
14073
  return node.kind === 324 /* JSDocLink */ || node.kind === 325 /* JSDocLinkCode */ || node.kind === 326 /* JSDocLinkPlain */;
14074
14074
  }
14075
14075
  ts.isJSDocLinkLike = isJSDocLinkLike;
14076
+ function hasRestParameter(s) {
14077
+ var last = ts.lastOrUndefined(s.parameters);
14078
+ return !!last && isRestParameter(last);
14079
+ }
14080
+ ts.hasRestParameter = hasRestParameter;
14081
+ function isRestParameter(node) {
14082
+ var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
14083
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
14084
+ }
14085
+ ts.isRestParameter = isRestParameter;
14076
14086
  // #endregion
14077
14087
  })(ts || (ts = {}));
14078
14088
  /* @internal */
@@ -16843,16 +16853,6 @@ var ts;
16843
16853
  return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
16844
16854
  }
16845
16855
  ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc;
16846
- function hasRestParameter(s) {
16847
- var last = ts.lastOrUndefined(s.parameters);
16848
- return !!last && isRestParameter(last);
16849
- }
16850
- ts.hasRestParameter = hasRestParameter;
16851
- function isRestParameter(node) {
16852
- var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
16853
- return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
16854
- }
16855
- ts.isRestParameter = isRestParameter;
16856
16856
  function hasTypeArguments(node) {
16857
16857
  return !!node.typeArguments;
16858
16858
  }
@@ -65465,6 +65465,20 @@ var ts;
65465
65465
  }
65466
65466
  }
65467
65467
  }
65468
+ if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
65469
+ // This is a carve-out in comparability to essentially forbid comparing a type parameter
65470
+ // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
65471
+ var constraint = getConstraintOfTypeParameter(source);
65472
+ if (constraint && hasNonCircularBaseConstraint(source)) {
65473
+ while (constraint && constraint.flags & 262144 /* TypeParameter */) {
65474
+ if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
65475
+ return result;
65476
+ }
65477
+ constraint = getConstraintOfTypeParameter(constraint);
65478
+ }
65479
+ }
65480
+ return 0 /* False */;
65481
+ }
65468
65482
  }
65469
65483
  else if (targetFlags & 4194304 /* Index */) {
65470
65484
  var targetType_1 = target.type;
@@ -65668,8 +65682,8 @@ var ts;
65668
65682
  if (sourceFlags & 8650752 /* TypeVariable */) {
65669
65683
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65670
65684
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65671
- var constraint = getConstraintOfType(source);
65672
- if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65685
+ var constraint = getConstraintOfType(source) || unknownType;
65686
+ if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65673
65687
  // A type variable with no constraint is not related to the non-primitive object type.
65674
65688
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65675
65689
  resetErrorInfo(saveErrorInfo);
@@ -65677,12 +65691,12 @@ var ts;
65677
65691
  }
65678
65692
  }
65679
65693
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65680
- else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65694
+ if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65681
65695
  resetErrorInfo(saveErrorInfo);
65682
65696
  return result;
65683
65697
  }
65684
65698
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65685
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65699
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65686
65700
  resetErrorInfo(saveErrorInfo);
65687
65701
  return result;
65688
65702
  }
@@ -72519,7 +72533,25 @@ var ts;
72519
72533
  }
72520
72534
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
72521
72535
  return mapType(type, function (t) {
72522
- var _a;
72536
+ if (t.flags & 2097152 /* Intersection */) {
72537
+ var intersection = t;
72538
+ var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
72539
+ if (newTypes.length > 0) {
72540
+ return getIntersectionType(newTypes);
72541
+ }
72542
+ newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
72543
+ if (newTypes.length > 0) {
72544
+ return getIntersectionType(newTypes);
72545
+ }
72546
+ return undefined;
72547
+ }
72548
+ var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
72549
+ if (concretePropertyType) {
72550
+ return concretePropertyType;
72551
+ }
72552
+ return getTypeOfApplicableIndexInfoOfContextualType(t);
72553
+ }, /*noReductions*/ true);
72554
+ function getTypeOfConcretePropertyOfContextualType(t) {
72523
72555
  if (isGenericMappedType(t) && !t.declaration.nameType) {
72524
72556
  var constraint = getConstraintTypeFromMappedType(t);
72525
72557
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
@@ -72527,8 +72559,9 @@ var ts;
72527
72559
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
72528
72560
  return substituteIndexedMappedType(t, propertyNameType);
72529
72561
  }
72562
+ return undefined;
72530
72563
  }
72531
- else if (t.flags & 3670016 /* StructuredType */) {
72564
+ if (t.flags & 3670016 /* StructuredType */) {
72532
72565
  var prop = getPropertyOfType(t, name);
72533
72566
  if (prop) {
72534
72567
  return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
@@ -72539,10 +72572,16 @@ var ts;
72539
72572
  return restType;
72540
72573
  }
72541
72574
  }
72542
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
72543
72575
  }
72544
72576
  return undefined;
72545
- }, /*noReductions*/ true);
72577
+ }
72578
+ function getTypeOfApplicableIndexInfoOfContextualType(t) {
72579
+ var _a;
72580
+ if (!(t.flags & 3670016 /* StructuredType */)) {
72581
+ return undefined;
72582
+ }
72583
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
72584
+ }
72546
72585
  }
72547
72586
  // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
72548
72587
  // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
@@ -81016,7 +81055,7 @@ var ts;
81016
81055
  * @param type The type of the promise.
81017
81056
  * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
81018
81057
  */
81019
- function getPromisedTypeOfPromise(type, errorNode) {
81058
+ function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
81020
81059
  //
81021
81060
  // { // type
81022
81061
  // then( // thenFunction
@@ -81051,7 +81090,29 @@ var ts;
81051
81090
  }
81052
81091
  return undefined;
81053
81092
  }
81054
- var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
81093
+ var thisTypeForError;
81094
+ var candidates;
81095
+ for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) {
81096
+ var thenSignature = thenSignatures_1[_i];
81097
+ var thisType = getThisTypeOfSignature(thenSignature);
81098
+ if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) {
81099
+ thisTypeForError = thisType;
81100
+ }
81101
+ else {
81102
+ candidates = ts.append(candidates, thenSignature);
81103
+ }
81104
+ }
81105
+ if (!candidates) {
81106
+ ts.Debug.assertIsDefined(thisTypeForError);
81107
+ if (thisTypeForErrorOut) {
81108
+ thisTypeForErrorOut.value = thisTypeForError;
81109
+ }
81110
+ if (errorNode) {
81111
+ error(errorNode, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
81112
+ }
81113
+ return undefined;
81114
+ }
81115
+ var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(candidates, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
81055
81116
  if (isTypeAny(onfulfilledParameterType)) {
81056
81117
  return undefined;
81057
81118
  }
@@ -81175,7 +81236,8 @@ var ts;
81175
81236
  var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
81176
81237
  return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
81177
81238
  }
81178
- var promisedType = getPromisedTypeOfPromise(type);
81239
+ var thisTypeForErrorOut = { value: undefined };
81240
+ var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
81179
81241
  if (promisedType) {
81180
81242
  if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
81181
81243
  // Verify that we don't have a bad actor in the form of a promise whose
@@ -81244,7 +81306,12 @@ var ts;
81244
81306
  if (isThenableType(type)) {
81245
81307
  if (errorNode) {
81246
81308
  ts.Debug.assertIsDefined(diagnosticMessage);
81247
- error(errorNode, diagnosticMessage, arg0);
81309
+ var chain = void 0;
81310
+ if (thisTypeForErrorOut.value) {
81311
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
81312
+ }
81313
+ chain = ts.chainDiagnosticMessages(chain, diagnosticMessage, arg0);
81314
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, chain));
81248
81315
  }
81249
81316
  return undefined;
81250
81317
  }
@@ -122360,6 +122427,8 @@ var ts;
122360
122427
  if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
122361
122428
  return fileName;
122362
122429
  var noExtension = ts.removeFileExtension(fileName);
122430
+ if (fileName === noExtension)
122431
+ return fileName;
122363
122432
  if (ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */]))
122364
122433
  return noExtension + getJSExtensionForFile(fileName, options);
122365
122434
  switch (ending) {
@@ -126434,6 +126503,8 @@ var ts;
126434
126503
  case 256 /* FunctionDeclaration */:
126435
126504
  case 213 /* FunctionExpression */:
126436
126505
  return getAdjustedLocationForFunction(node);
126506
+ case 171 /* Constructor */:
126507
+ return node;
126437
126508
  }
126438
126509
  }
126439
126510
  if (ts.isNamedDeclaration(node)) {
@@ -139532,11 +139603,12 @@ var ts;
139532
139603
  ts.forEachUnique(declarations, function (declaration) {
139533
139604
  for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) {
139534
139605
  var jsdoc = _a[_i];
139606
+ var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); });
139535
139607
  // skip comments containing @typedefs since they're not associated with particular declarations
139536
139608
  // Exceptions:
139537
139609
  // - @typedefs are themselves declarations with associated comments
139538
139610
  // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation
139539
- if (jsdoc.comment === undefined
139611
+ if (jsdoc.comment === undefined && !inheritDoc
139540
139612
  || ts.isJSDoc(jsdoc)
139541
139613
  && declaration.kind !== 345 /* JSDocTypedefTag */ && declaration.kind !== 338 /* JSDocCallbackTag */
139542
139614
  && jsdoc.tags
@@ -139544,7 +139616,10 @@ var ts;
139544
139616
  && !jsdoc.tags.some(function (t) { return t.kind === 340 /* JSDocParameterTag */ || t.kind === 341 /* JSDocReturnTag */; })) {
139545
139617
  continue;
139546
139618
  }
139547
- var newparts = getDisplayPartsFromComment(jsdoc.comment, checker);
139619
+ var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : [];
139620
+ if (inheritDoc && inheritDoc.comment) {
139621
+ newparts = newparts.concat(getDisplayPartsFromComment(inheritDoc.comment, checker));
139622
+ }
139548
139623
  if (!ts.contains(parts, newparts, isIdenticalListOfDisplayParts)) {
139549
139624
  parts.push(newparts);
139550
139625
  }
@@ -154300,6 +154375,7 @@ var ts;
154300
154375
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
154301
154376
  var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
154302
154377
  changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
154378
+ importAdder.writeFixes(changes);
154303
154379
  }
154304
154380
  function addJsxAttributes(changes, context, info) {
154305
154381
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
@@ -154308,7 +154384,7 @@ var ts;
154308
154384
  var jsxAttributesNode = info.parentDeclaration.attributes;
154309
154385
  var hasSpreadAttribute = ts.some(jsxAttributesNode.properties, ts.isJsxSpreadAttribute);
154310
154386
  var attrs = ts.map(info.attributes, function (attr) {
154311
- var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr));
154387
+ var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration);
154312
154388
  var name = ts.factory.createIdentifier(attr.name);
154313
154389
  var jsxAttribute = ts.factory.createJsxAttribute(name, ts.factory.createJsxExpression(/*dotDotDotToken*/ undefined, value));
154314
154390
  // formattingScanner requires the Identifier to have a context for scanning attributes with "-" (data-foo).
@@ -154318,6 +154394,7 @@ var ts;
154318
154394
  var jsxAttributes = ts.factory.createJsxAttributes(hasSpreadAttribute ? __spreadArray(__spreadArray([], attrs, true), jsxAttributesNode.properties, true) : __spreadArray(__spreadArray([], jsxAttributesNode.properties, true), attrs, true));
154319
154395
  var options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : undefined };
154320
154396
  changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options);
154397
+ importAdder.writeFixes(changes);
154321
154398
  }
154322
154399
  function addObjectLiteralProperties(changes, context, info) {
154323
154400
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
@@ -154325,7 +154402,7 @@ var ts;
154325
154402
  var target = ts.getEmitScriptTarget(context.program.getCompilerOptions());
154326
154403
  var checker = context.program.getTypeChecker();
154327
154404
  var props = ts.map(info.properties, function (prop) {
154328
- var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop));
154405
+ var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
154329
154406
  return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
154330
154407
  });
154331
154408
  var options = {
@@ -154334,8 +154411,9 @@ var ts;
154334
154411
  indentation: info.indentation
154335
154412
  };
154336
154413
  changes.replaceNode(context.sourceFile, info.parentDeclaration, ts.factory.createObjectLiteralExpression(__spreadArray(__spreadArray([], info.parentDeclaration.properties, true), props, true), /*multiLine*/ true), options);
154414
+ importAdder.writeFixes(changes);
154337
154415
  }
154338
- function tryGetValueFromType(context, checker, importAdder, quotePreference, type) {
154416
+ function tryGetValueFromType(context, checker, importAdder, quotePreference, type, enclosingDeclaration) {
154339
154417
  if (type.flags & 3 /* AnyOrUnknown */) {
154340
154418
  return createUndefined();
154341
154419
  }
@@ -154372,7 +154450,7 @@ var ts;
154372
154450
  return ts.factory.createNull();
154373
154451
  }
154374
154452
  if (type.flags & 1048576 /* Union */) {
154375
- var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t); });
154453
+ var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration); });
154376
154454
  return expression !== null && expression !== void 0 ? expression : createUndefined();
154377
154455
  }
154378
154456
  if (checker.isArrayLikeType(type)) {
@@ -154380,7 +154458,7 @@ var ts;
154380
154458
  }
154381
154459
  if (isObjectLiteralType(type)) {
154382
154460
  var props = ts.map(checker.getPropertiesOfType(type), function (prop) {
154383
- var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
154461
+ var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
154384
154462
  return ts.factory.createPropertyAssignment(prop.name, initializer);
154385
154463
  });
154386
154464
  return ts.factory.createObjectLiteralExpression(props, /*multiLine*/ true);
@@ -154392,7 +154470,7 @@ var ts;
154392
154470
  var signature = checker.getSignaturesOfType(type, 0 /* Call */);
154393
154471
  if (signature === undefined)
154394
154472
  return createUndefined();
154395
- var func = codefix.createSignatureDeclarationFromSignature(213 /* FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder);
154473
+ var func = codefix.createSignatureDeclarationFromSignature(213 /* FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder);
154396
154474
  return func !== null && func !== void 0 ? func : createUndefined();
154397
154475
  }
154398
154476
  if (ts.getObjectFlags(type) & 1 /* Class */) {
@@ -163679,7 +163757,7 @@ var ts;
163679
163757
  * @returns `true` if `node` has a JSDoc "inheritDoc" tag on it, otherwise `false`.
163680
163758
  */
163681
163759
  function hasJSDocInheritDocTag(node) {
163682
- return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
163760
+ return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc" || tag.tagName.text === "inheritdoc"; });
163683
163761
  }
163684
163762
  function getJsDocTagsOfDeclarations(declarations, checker) {
163685
163763
  if (!declarations)
@@ -163738,13 +163816,15 @@ var ts;
163738
163816
  }
163739
163817
  function findBaseOfDeclaration(checker, declaration, cb) {
163740
163818
  var _a;
163741
- if (ts.hasStaticModifier(declaration))
163742
- return;
163743
163819
  var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* Constructor */ ? declaration.parent.parent : declaration.parent;
163744
163820
  if (!classOrInterfaceDeclaration)
163745
163821
  return;
163822
+ var isStaticMember = ts.hasStaticModifier(declaration);
163746
163823
  return ts.firstDefined(ts.getAllSuperTypeNodes(classOrInterfaceDeclaration), function (superTypeNode) {
163747
- var symbol = checker.getPropertyOfType(checker.getTypeAtLocation(superTypeNode), declaration.symbol.name);
163824
+ var baseType = checker.getTypeAtLocation(superTypeNode);
163825
+ var symbol = isStaticMember
163826
+ ? ts.find(checker.getExportsOfModule(baseType.symbol), function (s) { return s.escapedName === declaration.symbol.name; })
163827
+ : checker.getPropertyOfType(baseType, declaration.symbol.name);
163748
163828
  return symbol ? cb(symbol) : undefined;
163749
163829
  });
163750
163830
  }
@@ -4510,6 +4510,8 @@ declare namespace ts {
4510
4510
  function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
4511
4511
  function isStringLiteralLike(node: Node): node is StringLiteralLike;
4512
4512
  function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain;
4513
+ function hasRestParameter(s: SignatureDeclaration | JSDocSignature): boolean;
4514
+ function isRestParameter(node: ParameterDeclaration | JSDocParameterTag): boolean;
4513
4515
  }
4514
4516
  declare namespace ts {
4515
4517
  const factory: NodeFactory;