typescript 4.8.0-dev.20220509 → 4.8.0-dev.20220512

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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220509";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220512";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8336,6 +8336,7 @@ var ts;
8336
8336
  String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."),
8337
8337
  Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."),
8338
8338
  or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."),
8339
+ or_JSX_element_expected: diag(1145, ts.DiagnosticCategory.Error, "or_JSX_element_expected_1145", "'{' or JSX element expected."),
8339
8340
  Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."),
8340
8341
  Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."),
8341
8342
  Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."),
@@ -8588,6 +8589,7 @@ var ts;
8588
8589
  resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
8589
8590
  resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
8590
8591
  Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),
8592
+ Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"),
8591
8593
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
8592
8594
  Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
8593
8595
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
@@ -14267,6 +14269,16 @@ var ts;
14267
14269
  return node.kind === 324 /* JSDocLink */ || node.kind === 325 /* JSDocLinkCode */ || node.kind === 326 /* JSDocLinkPlain */;
14268
14270
  }
14269
14271
  ts.isJSDocLinkLike = isJSDocLinkLike;
14272
+ function hasRestParameter(s) {
14273
+ var last = ts.lastOrUndefined(s.parameters);
14274
+ return !!last && isRestParameter(last);
14275
+ }
14276
+ ts.hasRestParameter = hasRestParameter;
14277
+ function isRestParameter(node) {
14278
+ var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
14279
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
14280
+ }
14281
+ ts.isRestParameter = isRestParameter;
14270
14282
  // #endregion
14271
14283
  })(ts || (ts = {}));
14272
14284
  /* @internal */
@@ -17037,16 +17049,6 @@ var ts;
17037
17049
  return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
17038
17050
  }
17039
17051
  ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc;
17040
- function hasRestParameter(s) {
17041
- var last = ts.lastOrUndefined(s.parameters);
17042
- return !!last && isRestParameter(last);
17043
- }
17044
- ts.hasRestParameter = hasRestParameter;
17045
- function isRestParameter(node) {
17046
- var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
17047
- return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
17048
- }
17049
- ts.isRestParameter = isRestParameter;
17050
17052
  function hasTypeArguments(node) {
17051
17053
  return !!node.typeArguments;
17052
17054
  }
@@ -34576,6 +34578,10 @@ var ts;
34576
34578
  // isn't actually allowed, but we want to treat it as a lambda so we can provide
34577
34579
  // a good error message.
34578
34580
  if (ts.isModifierKind(second) && second !== 131 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
34581
+ if (nextToken() === 127 /* AsKeyword */) {
34582
+ // https://github.com/microsoft/TypeScript/issues/44466
34583
+ return 0 /* False */;
34584
+ }
34579
34585
  return 1 /* True */;
34580
34586
  }
34581
34587
  // If we had "(" followed by something that's not an identifier,
@@ -35391,9 +35397,22 @@ var ts;
35391
35397
  }
35392
35398
  scanJsxIdentifier();
35393
35399
  var pos = getNodePos();
35394
- return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 /* EqualsToken */ ? undefined :
35395
- scanJsxAttributeValue() === 10 /* StringLiteral */ ? parseLiteralNode() :
35396
- parseJsxExpression(/*inExpressionContext*/ true)), pos);
35400
+ return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
35401
+ }
35402
+ function parseJsxAttributeValue() {
35403
+ if (token() === 63 /* EqualsToken */) {
35404
+ if (scanJsxAttributeValue() === 10 /* StringLiteral */) {
35405
+ return parseLiteralNode();
35406
+ }
35407
+ if (token() === 18 /* OpenBraceToken */) {
35408
+ return parseJsxExpression(/*inExpressionContext*/ true);
35409
+ }
35410
+ if (token() === 29 /* LessThanToken */) {
35411
+ return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true);
35412
+ }
35413
+ parseErrorAtCurrentToken(ts.Diagnostics.or_JSX_element_expected);
35414
+ }
35415
+ return undefined;
35397
35416
  }
35398
35417
  function parseJsxSpreadAttribute() {
35399
35418
  var pos = getNodePos();
@@ -41165,7 +41184,7 @@ var ts;
41165
41184
  return undefined;
41166
41185
  if (ts.length(specs) !== 1)
41167
41186
  return specs;
41168
- if (specs[0] === "**/*")
41187
+ if (specs[0] === ts.defaultIncludeSpec)
41169
41188
  return undefined;
41170
41189
  return specs;
41171
41190
  }
@@ -41443,6 +41462,8 @@ var ts;
41443
41462
  // until consistent casing errors are reported
41444
41463
  return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath));
41445
41464
  }
41465
+ /*@internal*/
41466
+ ts.defaultIncludeSpec = "**/*";
41446
41467
  /**
41447
41468
  * Parse the contents of a config file from json or json source file (tsconfig.json).
41448
41469
  * @param json The contents of the config file to parse
@@ -41508,6 +41529,7 @@ var ts;
41508
41529
  }
41509
41530
  var includeSpecs = toPropValue(getSpecsFromRaw("include"));
41510
41531
  var excludeOfRaw = getSpecsFromRaw("exclude");
41532
+ var isDefaultIncludeSpec = false;
41511
41533
  var excludeSpecs = toPropValue(excludeOfRaw);
41512
41534
  if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
41513
41535
  var outDir = raw.compilerOptions.outDir;
@@ -41517,7 +41539,8 @@ var ts;
41517
41539
  }
41518
41540
  }
41519
41541
  if (filesSpecs === undefined && includeSpecs === undefined) {
41520
- includeSpecs = ["**/*"];
41542
+ includeSpecs = [ts.defaultIncludeSpec];
41543
+ isDefaultIncludeSpec = true;
41521
41544
  }
41522
41545
  var validatedIncludeSpecs, validatedExcludeSpecs;
41523
41546
  // The exclude spec list is converted into a regular expression, which allows us to quickly
@@ -41536,7 +41559,8 @@ var ts;
41536
41559
  validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
41537
41560
  validatedIncludeSpecs: validatedIncludeSpecs,
41538
41561
  validatedExcludeSpecs: validatedExcludeSpecs,
41539
- pathPatterns: undefined, // Initialized on first use
41562
+ pathPatterns: undefined,
41563
+ isDefaultIncludeSpec: isDefaultIncludeSpec,
41540
41564
  };
41541
41565
  }
41542
41566
  function getFileNames(basePath) {
@@ -51661,8 +51685,9 @@ var ts;
51661
51685
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51662
51686
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51663
51687
  }
51664
- function symbolIsValue(symbol) {
51665
- return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
51688
+ function symbolIsValue(symbol, includeTypeOnlyMembers) {
51689
+ return !!(symbol.flags & 111551 /* Value */ ||
51690
+ symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
51666
51691
  }
51667
51692
  function findConstructorDeclaration(node) {
51668
51693
  var members = node.members;
@@ -59352,12 +59377,12 @@ var ts;
59352
59377
  * @param type a type to look up property from
59353
59378
  * @param name a name of property to look up in a given type
59354
59379
  */
59355
- function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
59380
+ function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
59356
59381
  type = getReducedApparentType(type);
59357
59382
  if (type.flags & 524288 /* Object */) {
59358
59383
  var resolved = resolveStructuredTypeMembers(type);
59359
59384
  var symbol = resolved.members.get(name);
59360
- if (symbol && symbolIsValue(symbol)) {
59385
+ if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
59361
59386
  return symbol;
59362
59387
  }
59363
59388
  if (skipObjectFunctionPropertyAugment)
@@ -62737,7 +62762,7 @@ var ts;
62737
62762
  // the `exports` lookup process that only looks up namespace members which is used for most type references
62738
62763
  var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
62739
62764
  var next = node.isTypeOf
62740
- ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText)
62765
+ ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ true)
62741
62766
  : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
62742
62767
  if (!next) {
62743
62768
  error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
@@ -65659,6 +65684,20 @@ var ts;
65659
65684
  }
65660
65685
  }
65661
65686
  }
65687
+ if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
65688
+ // This is a carve-out in comparability to essentially forbid comparing a type parameter
65689
+ // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
65690
+ var constraint = getConstraintOfTypeParameter(source);
65691
+ if (constraint && hasNonCircularBaseConstraint(source)) {
65692
+ while (constraint && constraint.flags & 262144 /* TypeParameter */) {
65693
+ if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
65694
+ return result;
65695
+ }
65696
+ constraint = getConstraintOfTypeParameter(constraint);
65697
+ }
65698
+ }
65699
+ return 0 /* False */;
65700
+ }
65662
65701
  }
65663
65702
  else if (targetFlags & 4194304 /* Index */) {
65664
65703
  var targetType_1 = target.type;
@@ -65862,8 +65901,8 @@ var ts;
65862
65901
  if (sourceFlags & 8650752 /* TypeVariable */) {
65863
65902
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65864
65903
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65865
- var constraint = getConstraintOfType(source);
65866
- if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65904
+ var constraint = getConstraintOfType(source) || unknownType;
65905
+ if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65867
65906
  // A type variable with no constraint is not related to the non-primitive object type.
65868
65907
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65869
65908
  resetErrorInfo(saveErrorInfo);
@@ -65871,12 +65910,12 @@ var ts;
65871
65910
  }
65872
65911
  }
65873
65912
  // 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
65874
- else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65913
+ if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65875
65914
  resetErrorInfo(saveErrorInfo);
65876
65915
  return result;
65877
65916
  }
65878
65917
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65879
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65918
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65880
65919
  resetErrorInfo(saveErrorInfo);
65881
65920
  return result;
65882
65921
  }
@@ -72713,7 +72752,25 @@ var ts;
72713
72752
  }
72714
72753
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
72715
72754
  return mapType(type, function (t) {
72716
- var _a;
72755
+ if (t.flags & 2097152 /* Intersection */) {
72756
+ var intersection = t;
72757
+ var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
72758
+ if (newTypes.length > 0) {
72759
+ return getIntersectionType(newTypes);
72760
+ }
72761
+ newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
72762
+ if (newTypes.length > 0) {
72763
+ return getIntersectionType(newTypes);
72764
+ }
72765
+ return undefined;
72766
+ }
72767
+ var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
72768
+ if (concretePropertyType) {
72769
+ return concretePropertyType;
72770
+ }
72771
+ return getTypeOfApplicableIndexInfoOfContextualType(t);
72772
+ }, /*noReductions*/ true);
72773
+ function getTypeOfConcretePropertyOfContextualType(t) {
72717
72774
  if (isGenericMappedType(t) && !t.declaration.nameType) {
72718
72775
  var constraint = getConstraintTypeFromMappedType(t);
72719
72776
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
@@ -72721,8 +72778,9 @@ var ts;
72721
72778
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
72722
72779
  return substituteIndexedMappedType(t, propertyNameType);
72723
72780
  }
72781
+ return undefined;
72724
72782
  }
72725
- else if (t.flags & 3670016 /* StructuredType */) {
72783
+ if (t.flags & 3670016 /* StructuredType */) {
72726
72784
  var prop = getPropertyOfType(t, name);
72727
72785
  if (prop) {
72728
72786
  return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
@@ -72733,10 +72791,16 @@ var ts;
72733
72791
  return restType;
72734
72792
  }
72735
72793
  }
72736
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
72737
72794
  }
72738
72795
  return undefined;
72739
- }, /*noReductions*/ true);
72796
+ }
72797
+ function getTypeOfApplicableIndexInfoOfContextualType(t) {
72798
+ var _a;
72799
+ if (!(t.flags & 3670016 /* StructuredType */)) {
72800
+ return undefined;
72801
+ }
72802
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
72803
+ }
72740
72804
  }
72741
72805
  // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
72742
72806
  // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
@@ -74614,9 +74678,8 @@ var ts;
74614
74678
  markAliasReferenced(parentSymbol, node);
74615
74679
  }
74616
74680
  return isErrorType(apparentType) ? errorType : apparentType;
74617
- ;
74618
74681
  }
74619
- prop = getPropertyOfType(apparentType, right.escapedText);
74682
+ prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* QualifiedName */);
74620
74683
  }
74621
74684
  // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
74622
74685
  // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
@@ -81210,7 +81273,7 @@ var ts;
81210
81273
  * @param type The type of the promise.
81211
81274
  * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
81212
81275
  */
81213
- function getPromisedTypeOfPromise(type, errorNode) {
81276
+ function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
81214
81277
  //
81215
81278
  // { // type
81216
81279
  // then( // thenFunction
@@ -81245,7 +81308,29 @@ var ts;
81245
81308
  }
81246
81309
  return undefined;
81247
81310
  }
81248
- var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
81311
+ var thisTypeForError;
81312
+ var candidates;
81313
+ for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) {
81314
+ var thenSignature = thenSignatures_1[_i];
81315
+ var thisType = getThisTypeOfSignature(thenSignature);
81316
+ if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) {
81317
+ thisTypeForError = thisType;
81318
+ }
81319
+ else {
81320
+ candidates = ts.append(candidates, thenSignature);
81321
+ }
81322
+ }
81323
+ if (!candidates) {
81324
+ ts.Debug.assertIsDefined(thisTypeForError);
81325
+ if (thisTypeForErrorOut) {
81326
+ thisTypeForErrorOut.value = thisTypeForError;
81327
+ }
81328
+ if (errorNode) {
81329
+ error(errorNode, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
81330
+ }
81331
+ return undefined;
81332
+ }
81333
+ var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(candidates, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
81249
81334
  if (isTypeAny(onfulfilledParameterType)) {
81250
81335
  return undefined;
81251
81336
  }
@@ -81369,7 +81454,8 @@ var ts;
81369
81454
  var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
81370
81455
  return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
81371
81456
  }
81372
- var promisedType = getPromisedTypeOfPromise(type);
81457
+ var thisTypeForErrorOut = { value: undefined };
81458
+ var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
81373
81459
  if (promisedType) {
81374
81460
  if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
81375
81461
  // Verify that we don't have a bad actor in the form of a promise whose
@@ -81438,7 +81524,12 @@ var ts;
81438
81524
  if (isThenableType(type)) {
81439
81525
  if (errorNode) {
81440
81526
  ts.Debug.assertIsDefined(diagnosticMessage);
81441
- error(errorNode, diagnosticMessage, arg0);
81527
+ var chain = void 0;
81528
+ if (thisTypeForErrorOut.value) {
81529
+ 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));
81530
+ }
81531
+ chain = ts.chainDiagnosticMessages(chain, diagnosticMessage, arg0);
81532
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, chain));
81442
81533
  }
81443
81534
  return undefined;
81444
81535
  }
@@ -97926,22 +98017,29 @@ var ts;
97926
98017
  if (node === undefined) {
97927
98018
  return factory.createTrue();
97928
98019
  }
97929
- else if (node.kind === 10 /* StringLiteral */) {
98020
+ if (node.kind === 10 /* StringLiteral */) {
97930
98021
  // Always recreate the literal to escape any escape sequences or newlines which may be in the original jsx string and which
97931
98022
  // Need to be escaped to be handled correctly in a normal string
97932
98023
  var singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
97933
98024
  var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
97934
98025
  return ts.setTextRange(literal, node);
97935
98026
  }
97936
- else if (node.kind === 288 /* JsxExpression */) {
98027
+ if (node.kind === 288 /* JsxExpression */) {
97937
98028
  if (node.expression === undefined) {
97938
98029
  return factory.createTrue();
97939
98030
  }
97940
98031
  return ts.visitNode(node.expression, visitor, ts.isExpression);
97941
98032
  }
97942
- else {
97943
- return ts.Debug.failBadSyntaxKind(node);
98033
+ if (ts.isJsxElement(node)) {
98034
+ return visitJsxElement(node, /*isChild*/ false);
98035
+ }
98036
+ if (ts.isJsxSelfClosingElement(node)) {
98037
+ return visitJsxSelfClosingElement(node, /*isChild*/ false);
97944
98038
  }
98039
+ if (ts.isJsxFragment(node)) {
98040
+ return visitJsxFragment(node, /*isChild*/ false);
98041
+ }
98042
+ return ts.Debug.failBadSyntaxKind(node);
97945
98043
  }
97946
98044
  function visitJsxText(node) {
97947
98045
  var fixed = fixupWhitespaceAndDecodeEntities(node.text);
@@ -118956,7 +119054,7 @@ var ts;
118956
119054
  }
118957
119055
  var matchedByInclude = ts.getMatchedIncludeSpec(program, fileName);
118958
119056
  // Could be additional files specified as roots
118959
- if (!matchedByInclude)
119057
+ if (!matchedByInclude || !ts.isString(matchedByInclude))
118960
119058
  return undefined;
118961
119059
  configFileNode = ts.getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
118962
119060
  message = ts.Diagnostics.File_is_matched_by_include_pattern_specified_here;
@@ -122554,6 +122652,8 @@ var ts;
122554
122652
  if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
122555
122653
  return fileName;
122556
122654
  var noExtension = ts.removeFileExtension(fileName);
122655
+ if (fileName === noExtension)
122656
+ return fileName;
122557
122657
  if (ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */]))
122558
122658
  return noExtension + getJSExtensionForFile(fileName, options);
122559
122659
  switch (ending) {
@@ -122842,6 +122942,9 @@ var ts;
122842
122942
  var configFile = program.getCompilerOptions().configFile;
122843
122943
  if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedIncludeSpecs))
122844
122944
  return undefined;
122945
+ // Return true if its default include spec
122946
+ if (configFile.configFileSpecs.isDefaultIncludeSpec)
122947
+ return true;
122845
122948
  var isJsonFile = ts.fileExtensionIs(fileName, ".json" /* Json */);
122846
122949
  var basePath = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
122847
122950
  var useCaseSensitiveFileNames = program.useCaseSensitiveFileNames();
@@ -122907,11 +123010,13 @@ var ts;
122907
123010
  if (matchedByFiles)
122908
123011
  return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Part_of_files_list_in_tsconfig_json);
122909
123012
  var matchedByInclude = getMatchedIncludeSpec(program, fileName);
122910
- return matchedByInclude ?
123013
+ return ts.isString(matchedByInclude) ?
122911
123014
  ts.chainDiagnosticMessages(
122912
123015
  /*details*/ undefined, ts.Diagnostics.Matched_by_include_pattern_0_in_1, matchedByInclude, toFileName(options.configFile, fileNameConvertor)) :
122913
- // Could be additional files specified as roots
122914
- ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Root_file_specified_for_compilation);
123016
+ // Could be additional files specified as roots or matched by default include
123017
+ ts.chainDiagnosticMessages(/*details*/ undefined, matchedByInclude ?
123018
+ ts.Diagnostics.Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk :
123019
+ ts.Diagnostics.Root_file_specified_for_compilation);
122915
123020
  case ts.FileIncludeKind.SourceFromProjectReference:
122916
123021
  case ts.FileIncludeKind.OutputFromProjectReference:
122917
123022
  var isOutput = reason.kind === ts.FileIncludeKind.OutputFromProjectReference;
@@ -127045,6 +127150,8 @@ var ts;
127045
127150
  case 256 /* FunctionDeclaration */:
127046
127151
  case 213 /* FunctionExpression */:
127047
127152
  return getAdjustedLocationForFunction(node);
127153
+ case 171 /* Constructor */:
127154
+ return node;
127048
127155
  }
127049
127156
  }
127050
127157
  if (ts.isNamedDeclaration(node)) {
@@ -140143,11 +140250,12 @@ var ts;
140143
140250
  ts.forEachUnique(declarations, function (declaration) {
140144
140251
  for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) {
140145
140252
  var jsdoc = _a[_i];
140253
+ 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"); });
140146
140254
  // skip comments containing @typedefs since they're not associated with particular declarations
140147
140255
  // Exceptions:
140148
140256
  // - @typedefs are themselves declarations with associated comments
140149
140257
  // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation
140150
- if (jsdoc.comment === undefined
140258
+ if (jsdoc.comment === undefined && !inheritDoc
140151
140259
  || ts.isJSDoc(jsdoc)
140152
140260
  && declaration.kind !== 345 /* JSDocTypedefTag */ && declaration.kind !== 338 /* JSDocCallbackTag */
140153
140261
  && jsdoc.tags
@@ -140155,7 +140263,10 @@ var ts;
140155
140263
  && !jsdoc.tags.some(function (t) { return t.kind === 340 /* JSDocParameterTag */ || t.kind === 341 /* JSDocReturnTag */; })) {
140156
140264
  continue;
140157
140265
  }
140158
- var newparts = getDisplayPartsFromComment(jsdoc.comment, checker);
140266
+ var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : [];
140267
+ if (inheritDoc && inheritDoc.comment) {
140268
+ newparts = newparts.concat(getDisplayPartsFromComment(inheritDoc.comment, checker));
140269
+ }
140159
140270
  if (!ts.contains(parts, newparts, isIdenticalListOfDisplayParts)) {
140160
140271
  parts.push(newparts);
140161
140272
  }
@@ -154911,6 +155022,7 @@ var ts;
154911
155022
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
154912
155023
  var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
154913
155024
  changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
155025
+ importAdder.writeFixes(changes);
154914
155026
  }
154915
155027
  function addJsxAttributes(changes, context, info) {
154916
155028
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
@@ -154919,7 +155031,7 @@ var ts;
154919
155031
  var jsxAttributesNode = info.parentDeclaration.attributes;
154920
155032
  var hasSpreadAttribute = ts.some(jsxAttributesNode.properties, ts.isJsxSpreadAttribute);
154921
155033
  var attrs = ts.map(info.attributes, function (attr) {
154922
- var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr));
155034
+ var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration);
154923
155035
  var name = ts.factory.createIdentifier(attr.name);
154924
155036
  var jsxAttribute = ts.factory.createJsxAttribute(name, ts.factory.createJsxExpression(/*dotDotDotToken*/ undefined, value));
154925
155037
  // formattingScanner requires the Identifier to have a context for scanning attributes with "-" (data-foo).
@@ -154929,6 +155041,7 @@ var ts;
154929
155041
  var jsxAttributes = ts.factory.createJsxAttributes(hasSpreadAttribute ? __spreadArray(__spreadArray([], attrs, true), jsxAttributesNode.properties, true) : __spreadArray(__spreadArray([], jsxAttributesNode.properties, true), attrs, true));
154930
155042
  var options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : undefined };
154931
155043
  changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options);
155044
+ importAdder.writeFixes(changes);
154932
155045
  }
154933
155046
  function addObjectLiteralProperties(changes, context, info) {
154934
155047
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
@@ -154936,7 +155049,7 @@ var ts;
154936
155049
  var target = ts.getEmitScriptTarget(context.program.getCompilerOptions());
154937
155050
  var checker = context.program.getTypeChecker();
154938
155051
  var props = ts.map(info.properties, function (prop) {
154939
- var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop));
155052
+ var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
154940
155053
  return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
154941
155054
  });
154942
155055
  var options = {
@@ -154945,8 +155058,9 @@ var ts;
154945
155058
  indentation: info.indentation
154946
155059
  };
154947
155060
  changes.replaceNode(context.sourceFile, info.parentDeclaration, ts.factory.createObjectLiteralExpression(__spreadArray(__spreadArray([], info.parentDeclaration.properties, true), props, true), /*multiLine*/ true), options);
155061
+ importAdder.writeFixes(changes);
154948
155062
  }
154949
- function tryGetValueFromType(context, checker, importAdder, quotePreference, type) {
155063
+ function tryGetValueFromType(context, checker, importAdder, quotePreference, type, enclosingDeclaration) {
154950
155064
  if (type.flags & 3 /* AnyOrUnknown */) {
154951
155065
  return createUndefined();
154952
155066
  }
@@ -154983,7 +155097,7 @@ var ts;
154983
155097
  return ts.factory.createNull();
154984
155098
  }
154985
155099
  if (type.flags & 1048576 /* Union */) {
154986
- var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t); });
155100
+ var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration); });
154987
155101
  return expression !== null && expression !== void 0 ? expression : createUndefined();
154988
155102
  }
154989
155103
  if (checker.isArrayLikeType(type)) {
@@ -154991,7 +155105,7 @@ var ts;
154991
155105
  }
154992
155106
  if (isObjectLiteralType(type)) {
154993
155107
  var props = ts.map(checker.getPropertiesOfType(type), function (prop) {
154994
- var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
155108
+ var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
154995
155109
  return ts.factory.createPropertyAssignment(prop.name, initializer);
154996
155110
  });
154997
155111
  return ts.factory.createObjectLiteralExpression(props, /*multiLine*/ true);
@@ -155003,7 +155117,7 @@ var ts;
155003
155117
  var signature = checker.getSignaturesOfType(type, 0 /* Call */);
155004
155118
  if (signature === undefined)
155005
155119
  return createUndefined();
155006
- 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);
155120
+ 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);
155007
155121
  return func !== null && func !== void 0 ? func : createUndefined();
155008
155122
  }
155009
155123
  if (ts.getObjectFlags(type) & 1 /* Class */) {
@@ -164290,7 +164404,7 @@ var ts;
164290
164404
  * @returns `true` if `node` has a JSDoc "inheritDoc" tag on it, otherwise `false`.
164291
164405
  */
164292
164406
  function hasJSDocInheritDocTag(node) {
164293
- return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
164407
+ return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc" || tag.tagName.text === "inheritdoc"; });
164294
164408
  }
164295
164409
  function getJsDocTagsOfDeclarations(declarations, checker) {
164296
164410
  if (!declarations)
@@ -164349,13 +164463,15 @@ var ts;
164349
164463
  }
164350
164464
  function findBaseOfDeclaration(checker, declaration, cb) {
164351
164465
  var _a;
164352
- if (ts.hasStaticModifier(declaration))
164353
- return;
164354
164466
  var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* Constructor */ ? declaration.parent.parent : declaration.parent;
164355
164467
  if (!classOrInterfaceDeclaration)
164356
164468
  return;
164469
+ var isStaticMember = ts.hasStaticModifier(declaration);
164357
164470
  return ts.firstDefined(ts.getAllSuperTypeNodes(classOrInterfaceDeclaration), function (superTypeNode) {
164358
- var symbol = checker.getPropertyOfType(checker.getTypeAtLocation(superTypeNode), declaration.symbol.name);
164471
+ var baseType = checker.getTypeAtLocation(superTypeNode);
164472
+ var symbol = isStaticMember
164473
+ ? ts.find(checker.getExportsOfModule(baseType.symbol), function (s) { return s.escapedName === declaration.symbol.name; })
164474
+ : checker.getPropertyOfType(baseType, declaration.symbol.name);
164359
164475
  return symbol ? cb(symbol) : undefined;
164360
164476
  });
164361
164477
  }