typescript 4.8.0-dev.20220508 → 4.8.0-dev.20220511
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +13 -11
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/lib.es2020.intl.d.ts +29 -5
- package/lib/lib.es2021.intl.d.ts +7 -3
- package/lib/lib.esnext.intl.d.ts +5 -1
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +12 -11
- package/lib/tsc.js +107 -28
- package/lib/tsserver.js +137 -42
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +137 -42
- package/lib/typescript.d.ts +2 -0
- package/lib/typescript.js +137 -42
- package/lib/typescriptServices.d.ts +2 -0
- package/lib/typescriptServices.js +137 -42
- package/lib/typingsInstaller.js +114 -30
- package/lib/zh-tw/diagnosticMessages.generated.json +12 -11
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -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.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220511";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8588,6 +8588,7 @@ var ts;
|
|
|
8588
8588
|
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
8589
|
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
8590
|
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`."),
|
|
8591
|
+
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
8592
|
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
8593
|
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
8594
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -14267,6 +14268,16 @@ var ts;
|
|
|
14267
14268
|
return node.kind === 324 /* JSDocLink */ || node.kind === 325 /* JSDocLinkCode */ || node.kind === 326 /* JSDocLinkPlain */;
|
|
14268
14269
|
}
|
|
14269
14270
|
ts.isJSDocLinkLike = isJSDocLinkLike;
|
|
14271
|
+
function hasRestParameter(s) {
|
|
14272
|
+
var last = ts.lastOrUndefined(s.parameters);
|
|
14273
|
+
return !!last && isRestParameter(last);
|
|
14274
|
+
}
|
|
14275
|
+
ts.hasRestParameter = hasRestParameter;
|
|
14276
|
+
function isRestParameter(node) {
|
|
14277
|
+
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
|
|
14278
|
+
return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
|
|
14279
|
+
}
|
|
14280
|
+
ts.isRestParameter = isRestParameter;
|
|
14270
14281
|
// #endregion
|
|
14271
14282
|
})(ts || (ts = {}));
|
|
14272
14283
|
/* @internal */
|
|
@@ -17037,16 +17048,6 @@ var ts;
|
|
|
17037
17048
|
return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
|
|
17038
17049
|
}
|
|
17039
17050
|
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
17051
|
function hasTypeArguments(node) {
|
|
17051
17052
|
return !!node.typeArguments;
|
|
17052
17053
|
}
|
|
@@ -34576,6 +34577,10 @@ var ts;
|
|
|
34576
34577
|
// isn't actually allowed, but we want to treat it as a lambda so we can provide
|
|
34577
34578
|
// a good error message.
|
|
34578
34579
|
if (ts.isModifierKind(second) && second !== 131 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
|
|
34580
|
+
if (nextToken() === 127 /* AsKeyword */) {
|
|
34581
|
+
// https://github.com/microsoft/TypeScript/issues/44466
|
|
34582
|
+
return 0 /* False */;
|
|
34583
|
+
}
|
|
34579
34584
|
return 1 /* True */;
|
|
34580
34585
|
}
|
|
34581
34586
|
// If we had "(" followed by something that's not an identifier,
|
|
@@ -41165,7 +41170,7 @@ var ts;
|
|
|
41165
41170
|
return undefined;
|
|
41166
41171
|
if (ts.length(specs) !== 1)
|
|
41167
41172
|
return specs;
|
|
41168
|
-
if (specs[0] ===
|
|
41173
|
+
if (specs[0] === ts.defaultIncludeSpec)
|
|
41169
41174
|
return undefined;
|
|
41170
41175
|
return specs;
|
|
41171
41176
|
}
|
|
@@ -41443,6 +41448,8 @@ var ts;
|
|
|
41443
41448
|
// until consistent casing errors are reported
|
|
41444
41449
|
return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath));
|
|
41445
41450
|
}
|
|
41451
|
+
/*@internal*/
|
|
41452
|
+
ts.defaultIncludeSpec = "**/*";
|
|
41446
41453
|
/**
|
|
41447
41454
|
* Parse the contents of a config file from json or json source file (tsconfig.json).
|
|
41448
41455
|
* @param json The contents of the config file to parse
|
|
@@ -41508,6 +41515,7 @@ var ts;
|
|
|
41508
41515
|
}
|
|
41509
41516
|
var includeSpecs = toPropValue(getSpecsFromRaw("include"));
|
|
41510
41517
|
var excludeOfRaw = getSpecsFromRaw("exclude");
|
|
41518
|
+
var isDefaultIncludeSpec = false;
|
|
41511
41519
|
var excludeSpecs = toPropValue(excludeOfRaw);
|
|
41512
41520
|
if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
|
|
41513
41521
|
var outDir = raw.compilerOptions.outDir;
|
|
@@ -41517,7 +41525,8 @@ var ts;
|
|
|
41517
41525
|
}
|
|
41518
41526
|
}
|
|
41519
41527
|
if (filesSpecs === undefined && includeSpecs === undefined) {
|
|
41520
|
-
includeSpecs = [
|
|
41528
|
+
includeSpecs = [ts.defaultIncludeSpec];
|
|
41529
|
+
isDefaultIncludeSpec = true;
|
|
41521
41530
|
}
|
|
41522
41531
|
var validatedIncludeSpecs, validatedExcludeSpecs;
|
|
41523
41532
|
// The exclude spec list is converted into a regular expression, which allows us to quickly
|
|
@@ -41536,7 +41545,8 @@ var ts;
|
|
|
41536
41545
|
validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
|
|
41537
41546
|
validatedIncludeSpecs: validatedIncludeSpecs,
|
|
41538
41547
|
validatedExcludeSpecs: validatedExcludeSpecs,
|
|
41539
|
-
pathPatterns: undefined,
|
|
41548
|
+
pathPatterns: undefined,
|
|
41549
|
+
isDefaultIncludeSpec: isDefaultIncludeSpec,
|
|
41540
41550
|
};
|
|
41541
41551
|
}
|
|
41542
41552
|
function getFileNames(basePath) {
|
|
@@ -65659,6 +65669,20 @@ var ts;
|
|
|
65659
65669
|
}
|
|
65660
65670
|
}
|
|
65661
65671
|
}
|
|
65672
|
+
if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
|
|
65673
|
+
// This is a carve-out in comparability to essentially forbid comparing a type parameter
|
|
65674
|
+
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
65675
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
65676
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
65677
|
+
while (constraint && constraint.flags & 262144 /* TypeParameter */) {
|
|
65678
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
|
|
65679
|
+
return result;
|
|
65680
|
+
}
|
|
65681
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
65682
|
+
}
|
|
65683
|
+
}
|
|
65684
|
+
return 0 /* False */;
|
|
65685
|
+
}
|
|
65662
65686
|
}
|
|
65663
65687
|
else if (targetFlags & 4194304 /* Index */) {
|
|
65664
65688
|
var targetType_1 = target.type;
|
|
@@ -65862,8 +65886,8 @@ var ts;
|
|
|
65862
65886
|
if (sourceFlags & 8650752 /* TypeVariable */) {
|
|
65863
65887
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65864
65888
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65865
|
-
var constraint = getConstraintOfType(source);
|
|
65866
|
-
if (!
|
|
65889
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
65890
|
+
if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65867
65891
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65868
65892
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65869
65893
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65871,12 +65895,12 @@ var ts;
|
|
|
65871
65895
|
}
|
|
65872
65896
|
}
|
|
65873
65897
|
// 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
|
-
|
|
65898
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65875
65899
|
resetErrorInfo(saveErrorInfo);
|
|
65876
65900
|
return result;
|
|
65877
65901
|
}
|
|
65878
65902
|
// 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)) {
|
|
65903
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65880
65904
|
resetErrorInfo(saveErrorInfo);
|
|
65881
65905
|
return result;
|
|
65882
65906
|
}
|
|
@@ -72713,7 +72737,25 @@ var ts;
|
|
|
72713
72737
|
}
|
|
72714
72738
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
72715
72739
|
return mapType(type, function (t) {
|
|
72716
|
-
|
|
72740
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
72741
|
+
var intersection = t;
|
|
72742
|
+
var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
|
|
72743
|
+
if (newTypes.length > 0) {
|
|
72744
|
+
return getIntersectionType(newTypes);
|
|
72745
|
+
}
|
|
72746
|
+
newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
|
|
72747
|
+
if (newTypes.length > 0) {
|
|
72748
|
+
return getIntersectionType(newTypes);
|
|
72749
|
+
}
|
|
72750
|
+
return undefined;
|
|
72751
|
+
}
|
|
72752
|
+
var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
|
|
72753
|
+
if (concretePropertyType) {
|
|
72754
|
+
return concretePropertyType;
|
|
72755
|
+
}
|
|
72756
|
+
return getTypeOfApplicableIndexInfoOfContextualType(t);
|
|
72757
|
+
}, /*noReductions*/ true);
|
|
72758
|
+
function getTypeOfConcretePropertyOfContextualType(t) {
|
|
72717
72759
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
72718
72760
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
72719
72761
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
@@ -72721,8 +72763,9 @@ var ts;
|
|
|
72721
72763
|
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
72722
72764
|
return substituteIndexedMappedType(t, propertyNameType);
|
|
72723
72765
|
}
|
|
72766
|
+
return undefined;
|
|
72724
72767
|
}
|
|
72725
|
-
|
|
72768
|
+
if (t.flags & 3670016 /* StructuredType */) {
|
|
72726
72769
|
var prop = getPropertyOfType(t, name);
|
|
72727
72770
|
if (prop) {
|
|
72728
72771
|
return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
|
|
@@ -72733,10 +72776,16 @@ var ts;
|
|
|
72733
72776
|
return restType;
|
|
72734
72777
|
}
|
|
72735
72778
|
}
|
|
72736
|
-
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
72737
72779
|
}
|
|
72738
72780
|
return undefined;
|
|
72739
|
-
}
|
|
72781
|
+
}
|
|
72782
|
+
function getTypeOfApplicableIndexInfoOfContextualType(t) {
|
|
72783
|
+
var _a;
|
|
72784
|
+
if (!(t.flags & 3670016 /* StructuredType */)) {
|
|
72785
|
+
return undefined;
|
|
72786
|
+
}
|
|
72787
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
72788
|
+
}
|
|
72740
72789
|
}
|
|
72741
72790
|
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
|
|
72742
72791
|
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
|
|
@@ -81210,7 +81259,7 @@ var ts;
|
|
|
81210
81259
|
* @param type The type of the promise.
|
|
81211
81260
|
* @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
|
|
81212
81261
|
*/
|
|
81213
|
-
function getPromisedTypeOfPromise(type, errorNode) {
|
|
81262
|
+
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
81214
81263
|
//
|
|
81215
81264
|
// { // type
|
|
81216
81265
|
// then( // thenFunction
|
|
@@ -81245,7 +81294,29 @@ var ts;
|
|
|
81245
81294
|
}
|
|
81246
81295
|
return undefined;
|
|
81247
81296
|
}
|
|
81248
|
-
var
|
|
81297
|
+
var thisTypeForError;
|
|
81298
|
+
var candidates;
|
|
81299
|
+
for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) {
|
|
81300
|
+
var thenSignature = thenSignatures_1[_i];
|
|
81301
|
+
var thisType = getThisTypeOfSignature(thenSignature);
|
|
81302
|
+
if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) {
|
|
81303
|
+
thisTypeForError = thisType;
|
|
81304
|
+
}
|
|
81305
|
+
else {
|
|
81306
|
+
candidates = ts.append(candidates, thenSignature);
|
|
81307
|
+
}
|
|
81308
|
+
}
|
|
81309
|
+
if (!candidates) {
|
|
81310
|
+
ts.Debug.assertIsDefined(thisTypeForError);
|
|
81311
|
+
if (thisTypeForErrorOut) {
|
|
81312
|
+
thisTypeForErrorOut.value = thisTypeForError;
|
|
81313
|
+
}
|
|
81314
|
+
if (errorNode) {
|
|
81315
|
+
error(errorNode, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
81316
|
+
}
|
|
81317
|
+
return undefined;
|
|
81318
|
+
}
|
|
81319
|
+
var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(candidates, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
|
|
81249
81320
|
if (isTypeAny(onfulfilledParameterType)) {
|
|
81250
81321
|
return undefined;
|
|
81251
81322
|
}
|
|
@@ -81369,7 +81440,8 @@ var ts;
|
|
|
81369
81440
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81370
81441
|
return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
|
|
81371
81442
|
}
|
|
81372
|
-
var
|
|
81443
|
+
var thisTypeForErrorOut = { value: undefined };
|
|
81444
|
+
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
81373
81445
|
if (promisedType) {
|
|
81374
81446
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
81375
81447
|
// Verify that we don't have a bad actor in the form of a promise whose
|
|
@@ -81438,7 +81510,12 @@ var ts;
|
|
|
81438
81510
|
if (isThenableType(type)) {
|
|
81439
81511
|
if (errorNode) {
|
|
81440
81512
|
ts.Debug.assertIsDefined(diagnosticMessage);
|
|
81441
|
-
|
|
81513
|
+
var chain = void 0;
|
|
81514
|
+
if (thisTypeForErrorOut.value) {
|
|
81515
|
+
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));
|
|
81516
|
+
}
|
|
81517
|
+
chain = ts.chainDiagnosticMessages(chain, diagnosticMessage, arg0);
|
|
81518
|
+
diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, chain));
|
|
81442
81519
|
}
|
|
81443
81520
|
return undefined;
|
|
81444
81521
|
}
|
|
@@ -118956,7 +119033,7 @@ var ts;
|
|
|
118956
119033
|
}
|
|
118957
119034
|
var matchedByInclude = ts.getMatchedIncludeSpec(program, fileName);
|
|
118958
119035
|
// Could be additional files specified as roots
|
|
118959
|
-
if (!matchedByInclude)
|
|
119036
|
+
if (!matchedByInclude || !ts.isString(matchedByInclude))
|
|
118960
119037
|
return undefined;
|
|
118961
119038
|
configFileNode = ts.getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
|
118962
119039
|
message = ts.Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
|
@@ -122554,6 +122631,8 @@ var ts;
|
|
|
122554
122631
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122555
122632
|
return fileName;
|
|
122556
122633
|
var noExtension = ts.removeFileExtension(fileName);
|
|
122634
|
+
if (fileName === noExtension)
|
|
122635
|
+
return fileName;
|
|
122557
122636
|
if (ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */]))
|
|
122558
122637
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122559
122638
|
switch (ending) {
|
|
@@ -122842,6 +122921,9 @@ var ts;
|
|
|
122842
122921
|
var configFile = program.getCompilerOptions().configFile;
|
|
122843
122922
|
if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedIncludeSpecs))
|
|
122844
122923
|
return undefined;
|
|
122924
|
+
// Return true if its default include spec
|
|
122925
|
+
if (configFile.configFileSpecs.isDefaultIncludeSpec)
|
|
122926
|
+
return true;
|
|
122845
122927
|
var isJsonFile = ts.fileExtensionIs(fileName, ".json" /* Json */);
|
|
122846
122928
|
var basePath = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
122847
122929
|
var useCaseSensitiveFileNames = program.useCaseSensitiveFileNames();
|
|
@@ -122907,11 +122989,13 @@ var ts;
|
|
|
122907
122989
|
if (matchedByFiles)
|
|
122908
122990
|
return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Part_of_files_list_in_tsconfig_json);
|
|
122909
122991
|
var matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
|
122910
|
-
return matchedByInclude ?
|
|
122992
|
+
return ts.isString(matchedByInclude) ?
|
|
122911
122993
|
ts.chainDiagnosticMessages(
|
|
122912
122994
|
/*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,
|
|
122995
|
+
// Could be additional files specified as roots or matched by default include
|
|
122996
|
+
ts.chainDiagnosticMessages(/*details*/ undefined, matchedByInclude ?
|
|
122997
|
+
ts.Diagnostics.Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk :
|
|
122998
|
+
ts.Diagnostics.Root_file_specified_for_compilation);
|
|
122915
122999
|
case ts.FileIncludeKind.SourceFromProjectReference:
|
|
122916
123000
|
case ts.FileIncludeKind.OutputFromProjectReference:
|
|
122917
123001
|
var isOutput = reason.kind === ts.FileIncludeKind.OutputFromProjectReference;
|
|
@@ -127045,6 +127129,8 @@ var ts;
|
|
|
127045
127129
|
case 256 /* FunctionDeclaration */:
|
|
127046
127130
|
case 213 /* FunctionExpression */:
|
|
127047
127131
|
return getAdjustedLocationForFunction(node);
|
|
127132
|
+
case 171 /* Constructor */:
|
|
127133
|
+
return node;
|
|
127048
127134
|
}
|
|
127049
127135
|
}
|
|
127050
127136
|
if (ts.isNamedDeclaration(node)) {
|
|
@@ -140143,11 +140229,12 @@ var ts;
|
|
|
140143
140229
|
ts.forEachUnique(declarations, function (declaration) {
|
|
140144
140230
|
for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) {
|
|
140145
140231
|
var jsdoc = _a[_i];
|
|
140232
|
+
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
140233
|
// skip comments containing @typedefs since they're not associated with particular declarations
|
|
140147
140234
|
// Exceptions:
|
|
140148
140235
|
// - @typedefs are themselves declarations with associated comments
|
|
140149
140236
|
// - @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
|
|
140237
|
+
if (jsdoc.comment === undefined && !inheritDoc
|
|
140151
140238
|
|| ts.isJSDoc(jsdoc)
|
|
140152
140239
|
&& declaration.kind !== 345 /* JSDocTypedefTag */ && declaration.kind !== 338 /* JSDocCallbackTag */
|
|
140153
140240
|
&& jsdoc.tags
|
|
@@ -140155,7 +140242,10 @@ var ts;
|
|
|
140155
140242
|
&& !jsdoc.tags.some(function (t) { return t.kind === 340 /* JSDocParameterTag */ || t.kind === 341 /* JSDocReturnTag */; })) {
|
|
140156
140243
|
continue;
|
|
140157
140244
|
}
|
|
140158
|
-
var newparts = getDisplayPartsFromComment(jsdoc.comment, checker);
|
|
140245
|
+
var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : [];
|
|
140246
|
+
if (inheritDoc && inheritDoc.comment) {
|
|
140247
|
+
newparts = newparts.concat(getDisplayPartsFromComment(inheritDoc.comment, checker));
|
|
140248
|
+
}
|
|
140159
140249
|
if (!ts.contains(parts, newparts, isIdenticalListOfDisplayParts)) {
|
|
140160
140250
|
parts.push(newparts);
|
|
140161
140251
|
}
|
|
@@ -154911,6 +155001,7 @@ var ts;
|
|
|
154911
155001
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
154912
155002
|
var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
|
|
154913
155003
|
changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
155004
|
+
importAdder.writeFixes(changes);
|
|
154914
155005
|
}
|
|
154915
155006
|
function addJsxAttributes(changes, context, info) {
|
|
154916
155007
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
@@ -154919,7 +155010,7 @@ var ts;
|
|
|
154919
155010
|
var jsxAttributesNode = info.parentDeclaration.attributes;
|
|
154920
155011
|
var hasSpreadAttribute = ts.some(jsxAttributesNode.properties, ts.isJsxSpreadAttribute);
|
|
154921
155012
|
var attrs = ts.map(info.attributes, function (attr) {
|
|
154922
|
-
var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr));
|
|
155013
|
+
var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration);
|
|
154923
155014
|
var name = ts.factory.createIdentifier(attr.name);
|
|
154924
155015
|
var jsxAttribute = ts.factory.createJsxAttribute(name, ts.factory.createJsxExpression(/*dotDotDotToken*/ undefined, value));
|
|
154925
155016
|
// formattingScanner requires the Identifier to have a context for scanning attributes with "-" (data-foo).
|
|
@@ -154929,6 +155020,7 @@ var ts;
|
|
|
154929
155020
|
var jsxAttributes = ts.factory.createJsxAttributes(hasSpreadAttribute ? __spreadArray(__spreadArray([], attrs, true), jsxAttributesNode.properties, true) : __spreadArray(__spreadArray([], jsxAttributesNode.properties, true), attrs, true));
|
|
154930
155021
|
var options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : undefined };
|
|
154931
155022
|
changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options);
|
|
155023
|
+
importAdder.writeFixes(changes);
|
|
154932
155024
|
}
|
|
154933
155025
|
function addObjectLiteralProperties(changes, context, info) {
|
|
154934
155026
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
@@ -154936,7 +155028,7 @@ var ts;
|
|
|
154936
155028
|
var target = ts.getEmitScriptTarget(context.program.getCompilerOptions());
|
|
154937
155029
|
var checker = context.program.getTypeChecker();
|
|
154938
155030
|
var props = ts.map(info.properties, function (prop) {
|
|
154939
|
-
var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop));
|
|
155031
|
+
var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
|
|
154940
155032
|
return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
|
|
154941
155033
|
});
|
|
154942
155034
|
var options = {
|
|
@@ -154945,8 +155037,9 @@ var ts;
|
|
|
154945
155037
|
indentation: info.indentation
|
|
154946
155038
|
};
|
|
154947
155039
|
changes.replaceNode(context.sourceFile, info.parentDeclaration, ts.factory.createObjectLiteralExpression(__spreadArray(__spreadArray([], info.parentDeclaration.properties, true), props, true), /*multiLine*/ true), options);
|
|
155040
|
+
importAdder.writeFixes(changes);
|
|
154948
155041
|
}
|
|
154949
|
-
function tryGetValueFromType(context, checker, importAdder, quotePreference, type) {
|
|
155042
|
+
function tryGetValueFromType(context, checker, importAdder, quotePreference, type, enclosingDeclaration) {
|
|
154950
155043
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
154951
155044
|
return createUndefined();
|
|
154952
155045
|
}
|
|
@@ -154983,7 +155076,7 @@ var ts;
|
|
|
154983
155076
|
return ts.factory.createNull();
|
|
154984
155077
|
}
|
|
154985
155078
|
if (type.flags & 1048576 /* Union */) {
|
|
154986
|
-
var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t); });
|
|
155079
|
+
var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration); });
|
|
154987
155080
|
return expression !== null && expression !== void 0 ? expression : createUndefined();
|
|
154988
155081
|
}
|
|
154989
155082
|
if (checker.isArrayLikeType(type)) {
|
|
@@ -154991,7 +155084,7 @@ var ts;
|
|
|
154991
155084
|
}
|
|
154992
155085
|
if (isObjectLiteralType(type)) {
|
|
154993
155086
|
var props = ts.map(checker.getPropertiesOfType(type), function (prop) {
|
|
154994
|
-
var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
|
|
155087
|
+
var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
|
|
154995
155088
|
return ts.factory.createPropertyAssignment(prop.name, initializer);
|
|
154996
155089
|
});
|
|
154997
155090
|
return ts.factory.createObjectLiteralExpression(props, /*multiLine*/ true);
|
|
@@ -155003,7 +155096,7 @@ var ts;
|
|
|
155003
155096
|
var signature = checker.getSignaturesOfType(type, 0 /* Call */);
|
|
155004
155097
|
if (signature === undefined)
|
|
155005
155098
|
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*/
|
|
155099
|
+
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
155100
|
return func !== null && func !== void 0 ? func : createUndefined();
|
|
155008
155101
|
}
|
|
155009
155102
|
if (ts.getObjectFlags(type) & 1 /* Class */) {
|
|
@@ -164290,7 +164383,7 @@ var ts;
|
|
|
164290
164383
|
* @returns `true` if `node` has a JSDoc "inheritDoc" tag on it, otherwise `false`.
|
|
164291
164384
|
*/
|
|
164292
164385
|
function hasJSDocInheritDocTag(node) {
|
|
164293
|
-
return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
|
|
164386
|
+
return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc" || tag.tagName.text === "inheritdoc"; });
|
|
164294
164387
|
}
|
|
164295
164388
|
function getJsDocTagsOfDeclarations(declarations, checker) {
|
|
164296
164389
|
if (!declarations)
|
|
@@ -164349,13 +164442,15 @@ var ts;
|
|
|
164349
164442
|
}
|
|
164350
164443
|
function findBaseOfDeclaration(checker, declaration, cb) {
|
|
164351
164444
|
var _a;
|
|
164352
|
-
if (ts.hasStaticModifier(declaration))
|
|
164353
|
-
return;
|
|
164354
164445
|
var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* Constructor */ ? declaration.parent.parent : declaration.parent;
|
|
164355
164446
|
if (!classOrInterfaceDeclaration)
|
|
164356
164447
|
return;
|
|
164448
|
+
var isStaticMember = ts.hasStaticModifier(declaration);
|
|
164357
164449
|
return ts.firstDefined(ts.getAllSuperTypeNodes(classOrInterfaceDeclaration), function (superTypeNode) {
|
|
164358
|
-
var
|
|
164450
|
+
var baseType = checker.getTypeAtLocation(superTypeNode);
|
|
164451
|
+
var symbol = isStaticMember
|
|
164452
|
+
? ts.find(checker.getExportsOfModule(baseType.symbol), function (s) { return s.escapedName === declaration.symbol.name; })
|
|
164453
|
+
: checker.getPropertyOfType(baseType, declaration.symbol.name);
|
|
164359
164454
|
return symbol ? cb(symbol) : undefined;
|
|
164360
164455
|
});
|
|
164361
164456
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -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;
|