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.
- 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/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- 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 +1 -0
- package/lib/tsc.js +142 -42
- package/lib/tsserver.js +172 -56
- package/lib/tsserverlibrary.d.ts +8 -5
- package/lib/tsserverlibrary.js +172 -56
- package/lib/typescript.d.ts +8 -5
- package/lib/typescript.js +172 -56
- package/lib/typescriptServices.d.ts +8 -5
- package/lib/typescriptServices.js +172 -56
- package/lib/typingsInstaller.js +149 -44
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220512";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8131,6 +8131,7 @@ var ts;
|
|
|
8131
8131
|
String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."),
|
|
8132
8132
|
Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."),
|
|
8133
8133
|
or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."),
|
|
8134
|
+
or_JSX_element_expected: diag(1145, ts.DiagnosticCategory.Error, "or_JSX_element_expected_1145", "'{' or JSX element expected."),
|
|
8134
8135
|
Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."),
|
|
8135
8136
|
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."),
|
|
8136
8137
|
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'."),
|
|
@@ -8383,6 +8384,7 @@ var ts;
|
|
|
8383
8384
|
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."),
|
|
8384
8385
|
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."),
|
|
8385
8386
|
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`."),
|
|
8387
|
+
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 '**/*'"),
|
|
8386
8388
|
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."),
|
|
8387
8389
|
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."),
|
|
8388
8390
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -14062,6 +14064,16 @@ var ts;
|
|
|
14062
14064
|
return node.kind === 324 /* JSDocLink */ || node.kind === 325 /* JSDocLinkCode */ || node.kind === 326 /* JSDocLinkPlain */;
|
|
14063
14065
|
}
|
|
14064
14066
|
ts.isJSDocLinkLike = isJSDocLinkLike;
|
|
14067
|
+
function hasRestParameter(s) {
|
|
14068
|
+
var last = ts.lastOrUndefined(s.parameters);
|
|
14069
|
+
return !!last && isRestParameter(last);
|
|
14070
|
+
}
|
|
14071
|
+
ts.hasRestParameter = hasRestParameter;
|
|
14072
|
+
function isRestParameter(node) {
|
|
14073
|
+
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
|
|
14074
|
+
return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
|
|
14075
|
+
}
|
|
14076
|
+
ts.isRestParameter = isRestParameter;
|
|
14065
14077
|
// #endregion
|
|
14066
14078
|
})(ts || (ts = {}));
|
|
14067
14079
|
/* @internal */
|
|
@@ -16832,16 +16844,6 @@ var ts;
|
|
|
16832
16844
|
return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
|
|
16833
16845
|
}
|
|
16834
16846
|
ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc;
|
|
16835
|
-
function hasRestParameter(s) {
|
|
16836
|
-
var last = ts.lastOrUndefined(s.parameters);
|
|
16837
|
-
return !!last && isRestParameter(last);
|
|
16838
|
-
}
|
|
16839
|
-
ts.hasRestParameter = hasRestParameter;
|
|
16840
|
-
function isRestParameter(node) {
|
|
16841
|
-
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
|
|
16842
|
-
return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* JSDocVariadicType */;
|
|
16843
|
-
}
|
|
16844
|
-
ts.isRestParameter = isRestParameter;
|
|
16845
16847
|
function hasTypeArguments(node) {
|
|
16846
16848
|
return !!node.typeArguments;
|
|
16847
16849
|
}
|
|
@@ -34371,6 +34373,10 @@ var ts;
|
|
|
34371
34373
|
// isn't actually allowed, but we want to treat it as a lambda so we can provide
|
|
34372
34374
|
// a good error message.
|
|
34373
34375
|
if (ts.isModifierKind(second) && second !== 131 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
|
|
34376
|
+
if (nextToken() === 127 /* AsKeyword */) {
|
|
34377
|
+
// https://github.com/microsoft/TypeScript/issues/44466
|
|
34378
|
+
return 0 /* False */;
|
|
34379
|
+
}
|
|
34374
34380
|
return 1 /* True */;
|
|
34375
34381
|
}
|
|
34376
34382
|
// If we had "(" followed by something that's not an identifier,
|
|
@@ -35186,9 +35192,22 @@ var ts;
|
|
|
35186
35192
|
}
|
|
35187
35193
|
scanJsxIdentifier();
|
|
35188
35194
|
var pos = getNodePos();
|
|
35189
|
-
return finishNode(factory.createJsxAttribute(parseIdentifierName(),
|
|
35190
|
-
|
|
35191
|
-
|
|
35195
|
+
return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
|
|
35196
|
+
}
|
|
35197
|
+
function parseJsxAttributeValue() {
|
|
35198
|
+
if (token() === 63 /* EqualsToken */) {
|
|
35199
|
+
if (scanJsxAttributeValue() === 10 /* StringLiteral */) {
|
|
35200
|
+
return parseLiteralNode();
|
|
35201
|
+
}
|
|
35202
|
+
if (token() === 18 /* OpenBraceToken */) {
|
|
35203
|
+
return parseJsxExpression(/*inExpressionContext*/ true);
|
|
35204
|
+
}
|
|
35205
|
+
if (token() === 29 /* LessThanToken */) {
|
|
35206
|
+
return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true);
|
|
35207
|
+
}
|
|
35208
|
+
parseErrorAtCurrentToken(ts.Diagnostics.or_JSX_element_expected);
|
|
35209
|
+
}
|
|
35210
|
+
return undefined;
|
|
35192
35211
|
}
|
|
35193
35212
|
function parseJsxSpreadAttribute() {
|
|
35194
35213
|
var pos = getNodePos();
|
|
@@ -40960,7 +40979,7 @@ var ts;
|
|
|
40960
40979
|
return undefined;
|
|
40961
40980
|
if (ts.length(specs) !== 1)
|
|
40962
40981
|
return specs;
|
|
40963
|
-
if (specs[0] ===
|
|
40982
|
+
if (specs[0] === ts.defaultIncludeSpec)
|
|
40964
40983
|
return undefined;
|
|
40965
40984
|
return specs;
|
|
40966
40985
|
}
|
|
@@ -41238,6 +41257,8 @@ var ts;
|
|
|
41238
41257
|
// until consistent casing errors are reported
|
|
41239
41258
|
return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath));
|
|
41240
41259
|
}
|
|
41260
|
+
/*@internal*/
|
|
41261
|
+
ts.defaultIncludeSpec = "**/*";
|
|
41241
41262
|
/**
|
|
41242
41263
|
* Parse the contents of a config file from json or json source file (tsconfig.json).
|
|
41243
41264
|
* @param json The contents of the config file to parse
|
|
@@ -41303,6 +41324,7 @@ var ts;
|
|
|
41303
41324
|
}
|
|
41304
41325
|
var includeSpecs = toPropValue(getSpecsFromRaw("include"));
|
|
41305
41326
|
var excludeOfRaw = getSpecsFromRaw("exclude");
|
|
41327
|
+
var isDefaultIncludeSpec = false;
|
|
41306
41328
|
var excludeSpecs = toPropValue(excludeOfRaw);
|
|
41307
41329
|
if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
|
|
41308
41330
|
var outDir = raw.compilerOptions.outDir;
|
|
@@ -41312,7 +41334,8 @@ var ts;
|
|
|
41312
41334
|
}
|
|
41313
41335
|
}
|
|
41314
41336
|
if (filesSpecs === undefined && includeSpecs === undefined) {
|
|
41315
|
-
includeSpecs = [
|
|
41337
|
+
includeSpecs = [ts.defaultIncludeSpec];
|
|
41338
|
+
isDefaultIncludeSpec = true;
|
|
41316
41339
|
}
|
|
41317
41340
|
var validatedIncludeSpecs, validatedExcludeSpecs;
|
|
41318
41341
|
// The exclude spec list is converted into a regular expression, which allows us to quickly
|
|
@@ -41331,7 +41354,8 @@ var ts;
|
|
|
41331
41354
|
validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
|
|
41332
41355
|
validatedIncludeSpecs: validatedIncludeSpecs,
|
|
41333
41356
|
validatedExcludeSpecs: validatedExcludeSpecs,
|
|
41334
|
-
pathPatterns: undefined,
|
|
41357
|
+
pathPatterns: undefined,
|
|
41358
|
+
isDefaultIncludeSpec: isDefaultIncludeSpec,
|
|
41335
41359
|
};
|
|
41336
41360
|
}
|
|
41337
41361
|
function getFileNames(basePath) {
|
|
@@ -51456,8 +51480,9 @@ var ts;
|
|
|
51456
51480
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
51457
51481
|
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51458
51482
|
}
|
|
51459
|
-
function symbolIsValue(symbol) {
|
|
51460
|
-
return !!(symbol.flags & 111551 /* Value */ ||
|
|
51483
|
+
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
51484
|
+
return !!(symbol.flags & 111551 /* Value */ ||
|
|
51485
|
+
symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
|
|
51461
51486
|
}
|
|
51462
51487
|
function findConstructorDeclaration(node) {
|
|
51463
51488
|
var members = node.members;
|
|
@@ -59147,12 +59172,12 @@ var ts;
|
|
|
59147
59172
|
* @param type a type to look up property from
|
|
59148
59173
|
* @param name a name of property to look up in a given type
|
|
59149
59174
|
*/
|
|
59150
|
-
function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
|
|
59175
|
+
function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
|
|
59151
59176
|
type = getReducedApparentType(type);
|
|
59152
59177
|
if (type.flags & 524288 /* Object */) {
|
|
59153
59178
|
var resolved = resolveStructuredTypeMembers(type);
|
|
59154
59179
|
var symbol = resolved.members.get(name);
|
|
59155
|
-
if (symbol && symbolIsValue(symbol)) {
|
|
59180
|
+
if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
|
|
59156
59181
|
return symbol;
|
|
59157
59182
|
}
|
|
59158
59183
|
if (skipObjectFunctionPropertyAugment)
|
|
@@ -62532,7 +62557,7 @@ var ts;
|
|
|
62532
62557
|
// the `exports` lookup process that only looks up namespace members which is used for most type references
|
|
62533
62558
|
var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
|
|
62534
62559
|
var next = node.isTypeOf
|
|
62535
|
-
? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText)
|
|
62560
|
+
? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ true)
|
|
62536
62561
|
: getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
62537
62562
|
if (!next) {
|
|
62538
62563
|
error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
|
|
@@ -65454,6 +65479,20 @@ var ts;
|
|
|
65454
65479
|
}
|
|
65455
65480
|
}
|
|
65456
65481
|
}
|
|
65482
|
+
if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
|
|
65483
|
+
// This is a carve-out in comparability to essentially forbid comparing a type parameter
|
|
65484
|
+
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
65485
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
65486
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
65487
|
+
while (constraint && constraint.flags & 262144 /* TypeParameter */) {
|
|
65488
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
|
|
65489
|
+
return result;
|
|
65490
|
+
}
|
|
65491
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
65492
|
+
}
|
|
65493
|
+
}
|
|
65494
|
+
return 0 /* False */;
|
|
65495
|
+
}
|
|
65457
65496
|
}
|
|
65458
65497
|
else if (targetFlags & 4194304 /* Index */) {
|
|
65459
65498
|
var targetType_1 = target.type;
|
|
@@ -65657,8 +65696,8 @@ var ts;
|
|
|
65657
65696
|
if (sourceFlags & 8650752 /* TypeVariable */) {
|
|
65658
65697
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65659
65698
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65660
|
-
var constraint = getConstraintOfType(source);
|
|
65661
|
-
if (!
|
|
65699
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
65700
|
+
if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65662
65701
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65663
65702
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65664
65703
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65666,12 +65705,12 @@ var ts;
|
|
|
65666
65705
|
}
|
|
65667
65706
|
}
|
|
65668
65707
|
// 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
|
|
65669
|
-
|
|
65708
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65670
65709
|
resetErrorInfo(saveErrorInfo);
|
|
65671
65710
|
return result;
|
|
65672
65711
|
}
|
|
65673
65712
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65674
|
-
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65713
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65675
65714
|
resetErrorInfo(saveErrorInfo);
|
|
65676
65715
|
return result;
|
|
65677
65716
|
}
|
|
@@ -72508,7 +72547,25 @@ var ts;
|
|
|
72508
72547
|
}
|
|
72509
72548
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
72510
72549
|
return mapType(type, function (t) {
|
|
72511
|
-
|
|
72550
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
72551
|
+
var intersection = t;
|
|
72552
|
+
var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
|
|
72553
|
+
if (newTypes.length > 0) {
|
|
72554
|
+
return getIntersectionType(newTypes);
|
|
72555
|
+
}
|
|
72556
|
+
newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
|
|
72557
|
+
if (newTypes.length > 0) {
|
|
72558
|
+
return getIntersectionType(newTypes);
|
|
72559
|
+
}
|
|
72560
|
+
return undefined;
|
|
72561
|
+
}
|
|
72562
|
+
var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
|
|
72563
|
+
if (concretePropertyType) {
|
|
72564
|
+
return concretePropertyType;
|
|
72565
|
+
}
|
|
72566
|
+
return getTypeOfApplicableIndexInfoOfContextualType(t);
|
|
72567
|
+
}, /*noReductions*/ true);
|
|
72568
|
+
function getTypeOfConcretePropertyOfContextualType(t) {
|
|
72512
72569
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
72513
72570
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
72514
72571
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
@@ -72516,8 +72573,9 @@ var ts;
|
|
|
72516
72573
|
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
72517
72574
|
return substituteIndexedMappedType(t, propertyNameType);
|
|
72518
72575
|
}
|
|
72576
|
+
return undefined;
|
|
72519
72577
|
}
|
|
72520
|
-
|
|
72578
|
+
if (t.flags & 3670016 /* StructuredType */) {
|
|
72521
72579
|
var prop = getPropertyOfType(t, name);
|
|
72522
72580
|
if (prop) {
|
|
72523
72581
|
return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
|
|
@@ -72528,10 +72586,16 @@ var ts;
|
|
|
72528
72586
|
return restType;
|
|
72529
72587
|
}
|
|
72530
72588
|
}
|
|
72531
|
-
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
72532
72589
|
}
|
|
72533
72590
|
return undefined;
|
|
72534
|
-
}
|
|
72591
|
+
}
|
|
72592
|
+
function getTypeOfApplicableIndexInfoOfContextualType(t) {
|
|
72593
|
+
var _a;
|
|
72594
|
+
if (!(t.flags & 3670016 /* StructuredType */)) {
|
|
72595
|
+
return undefined;
|
|
72596
|
+
}
|
|
72597
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
72598
|
+
}
|
|
72535
72599
|
}
|
|
72536
72600
|
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
|
|
72537
72601
|
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
|
|
@@ -74409,9 +74473,8 @@ var ts;
|
|
|
74409
74473
|
markAliasReferenced(parentSymbol, node);
|
|
74410
74474
|
}
|
|
74411
74475
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
74412
|
-
;
|
|
74413
74476
|
}
|
|
74414
|
-
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74477
|
+
prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* QualifiedName */);
|
|
74415
74478
|
}
|
|
74416
74479
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74417
74480
|
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
@@ -81005,7 +81068,7 @@ var ts;
|
|
|
81005
81068
|
* @param type The type of the promise.
|
|
81006
81069
|
* @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
|
|
81007
81070
|
*/
|
|
81008
|
-
function getPromisedTypeOfPromise(type, errorNode) {
|
|
81071
|
+
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
81009
81072
|
//
|
|
81010
81073
|
// { // type
|
|
81011
81074
|
// then( // thenFunction
|
|
@@ -81040,7 +81103,29 @@ var ts;
|
|
|
81040
81103
|
}
|
|
81041
81104
|
return undefined;
|
|
81042
81105
|
}
|
|
81043
|
-
var
|
|
81106
|
+
var thisTypeForError;
|
|
81107
|
+
var candidates;
|
|
81108
|
+
for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) {
|
|
81109
|
+
var thenSignature = thenSignatures_1[_i];
|
|
81110
|
+
var thisType = getThisTypeOfSignature(thenSignature);
|
|
81111
|
+
if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) {
|
|
81112
|
+
thisTypeForError = thisType;
|
|
81113
|
+
}
|
|
81114
|
+
else {
|
|
81115
|
+
candidates = ts.append(candidates, thenSignature);
|
|
81116
|
+
}
|
|
81117
|
+
}
|
|
81118
|
+
if (!candidates) {
|
|
81119
|
+
ts.Debug.assertIsDefined(thisTypeForError);
|
|
81120
|
+
if (thisTypeForErrorOut) {
|
|
81121
|
+
thisTypeForErrorOut.value = thisTypeForError;
|
|
81122
|
+
}
|
|
81123
|
+
if (errorNode) {
|
|
81124
|
+
error(errorNode, ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
81125
|
+
}
|
|
81126
|
+
return undefined;
|
|
81127
|
+
}
|
|
81128
|
+
var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(candidates, getTypeOfFirstParameterOfSignature)), 2097152 /* NEUndefinedOrNull */);
|
|
81044
81129
|
if (isTypeAny(onfulfilledParameterType)) {
|
|
81045
81130
|
return undefined;
|
|
81046
81131
|
}
|
|
@@ -81164,7 +81249,8 @@ var ts;
|
|
|
81164
81249
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81165
81250
|
return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
|
|
81166
81251
|
}
|
|
81167
|
-
var
|
|
81252
|
+
var thisTypeForErrorOut = { value: undefined };
|
|
81253
|
+
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
81168
81254
|
if (promisedType) {
|
|
81169
81255
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
81170
81256
|
// Verify that we don't have a bad actor in the form of a promise whose
|
|
@@ -81233,7 +81319,12 @@ var ts;
|
|
|
81233
81319
|
if (isThenableType(type)) {
|
|
81234
81320
|
if (errorNode) {
|
|
81235
81321
|
ts.Debug.assertIsDefined(diagnosticMessage);
|
|
81236
|
-
|
|
81322
|
+
var chain = void 0;
|
|
81323
|
+
if (thisTypeForErrorOut.value) {
|
|
81324
|
+
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));
|
|
81325
|
+
}
|
|
81326
|
+
chain = ts.chainDiagnosticMessages(chain, diagnosticMessage, arg0);
|
|
81327
|
+
diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, chain));
|
|
81237
81328
|
}
|
|
81238
81329
|
return undefined;
|
|
81239
81330
|
}
|
|
@@ -97721,22 +97812,29 @@ var ts;
|
|
|
97721
97812
|
if (node === undefined) {
|
|
97722
97813
|
return factory.createTrue();
|
|
97723
97814
|
}
|
|
97724
|
-
|
|
97815
|
+
if (node.kind === 10 /* StringLiteral */) {
|
|
97725
97816
|
// Always recreate the literal to escape any escape sequences or newlines which may be in the original jsx string and which
|
|
97726
97817
|
// Need to be escaped to be handled correctly in a normal string
|
|
97727
97818
|
var singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
|
|
97728
97819
|
var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
|
|
97729
97820
|
return ts.setTextRange(literal, node);
|
|
97730
97821
|
}
|
|
97731
|
-
|
|
97822
|
+
if (node.kind === 288 /* JsxExpression */) {
|
|
97732
97823
|
if (node.expression === undefined) {
|
|
97733
97824
|
return factory.createTrue();
|
|
97734
97825
|
}
|
|
97735
97826
|
return ts.visitNode(node.expression, visitor, ts.isExpression);
|
|
97736
97827
|
}
|
|
97737
|
-
|
|
97738
|
-
return
|
|
97828
|
+
if (ts.isJsxElement(node)) {
|
|
97829
|
+
return visitJsxElement(node, /*isChild*/ false);
|
|
97830
|
+
}
|
|
97831
|
+
if (ts.isJsxSelfClosingElement(node)) {
|
|
97832
|
+
return visitJsxSelfClosingElement(node, /*isChild*/ false);
|
|
97739
97833
|
}
|
|
97834
|
+
if (ts.isJsxFragment(node)) {
|
|
97835
|
+
return visitJsxFragment(node, /*isChild*/ false);
|
|
97836
|
+
}
|
|
97837
|
+
return ts.Debug.failBadSyntaxKind(node);
|
|
97740
97838
|
}
|
|
97741
97839
|
function visitJsxText(node) {
|
|
97742
97840
|
var fixed = fixupWhitespaceAndDecodeEntities(node.text);
|
|
@@ -118751,7 +118849,7 @@ var ts;
|
|
|
118751
118849
|
}
|
|
118752
118850
|
var matchedByInclude = ts.getMatchedIncludeSpec(program, fileName);
|
|
118753
118851
|
// Could be additional files specified as roots
|
|
118754
|
-
if (!matchedByInclude)
|
|
118852
|
+
if (!matchedByInclude || !ts.isString(matchedByInclude))
|
|
118755
118853
|
return undefined;
|
|
118756
118854
|
configFileNode = ts.getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
|
118757
118855
|
message = ts.Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
|
@@ -122349,6 +122447,8 @@ var ts;
|
|
|
122349
122447
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122350
122448
|
return fileName;
|
|
122351
122449
|
var noExtension = ts.removeFileExtension(fileName);
|
|
122450
|
+
if (fileName === noExtension)
|
|
122451
|
+
return fileName;
|
|
122352
122452
|
if (ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */]))
|
|
122353
122453
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122354
122454
|
switch (ending) {
|
|
@@ -122637,6 +122737,9 @@ var ts;
|
|
|
122637
122737
|
var configFile = program.getCompilerOptions().configFile;
|
|
122638
122738
|
if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedIncludeSpecs))
|
|
122639
122739
|
return undefined;
|
|
122740
|
+
// Return true if its default include spec
|
|
122741
|
+
if (configFile.configFileSpecs.isDefaultIncludeSpec)
|
|
122742
|
+
return true;
|
|
122640
122743
|
var isJsonFile = ts.fileExtensionIs(fileName, ".json" /* Json */);
|
|
122641
122744
|
var basePath = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
122642
122745
|
var useCaseSensitiveFileNames = program.useCaseSensitiveFileNames();
|
|
@@ -122702,11 +122805,13 @@ var ts;
|
|
|
122702
122805
|
if (matchedByFiles)
|
|
122703
122806
|
return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Part_of_files_list_in_tsconfig_json);
|
|
122704
122807
|
var matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
|
122705
|
-
return matchedByInclude ?
|
|
122808
|
+
return ts.isString(matchedByInclude) ?
|
|
122706
122809
|
ts.chainDiagnosticMessages(
|
|
122707
122810
|
/*details*/ undefined, ts.Diagnostics.Matched_by_include_pattern_0_in_1, matchedByInclude, toFileName(options.configFile, fileNameConvertor)) :
|
|
122708
|
-
// Could be additional files specified as roots
|
|
122709
|
-
ts.chainDiagnosticMessages(/*details*/ undefined,
|
|
122811
|
+
// Could be additional files specified as roots or matched by default include
|
|
122812
|
+
ts.chainDiagnosticMessages(/*details*/ undefined, matchedByInclude ?
|
|
122813
|
+
ts.Diagnostics.Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk :
|
|
122814
|
+
ts.Diagnostics.Root_file_specified_for_compilation);
|
|
122710
122815
|
case ts.FileIncludeKind.SourceFromProjectReference:
|
|
122711
122816
|
case ts.FileIncludeKind.OutputFromProjectReference:
|
|
122712
122817
|
var isOutput = reason.kind === ts.FileIncludeKind.OutputFromProjectReference;
|
|
@@ -1199,6 +1199,7 @@
|
|
|
1199
1199
|
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "所需的类型参数可能不遵循可选类型参数。",
|
|
1200
1200
|
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "在位置“{1}”的缓存中找到模块“{0}”的解析。",
|
|
1201
1201
|
"Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "在位置“{1}”的缓存中找到类型引用指令“{0}”的解析。",
|
|
1202
|
+
"Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125": "解决模式断言不稳定。使用夜间 TypeScript 消除此错误。请尝试使用 “npm install -D typescript@next” 进行更新。",
|
|
1202
1203
|
"Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452": "仅当 `moduleResolution` 为 `node16` 或 `nodenext` 时才支持解析模式。",
|
|
1203
1204
|
"Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "只将 \"keyof\" 解析为字符串值的属性名称(不含数字或符号)。",
|
|
1204
1205
|
"Resolving_module_0_from_1_6086": "======== 正在从“{1}”解析模块“{0}”。========",
|
|
@@ -1199,6 +1199,7 @@
|
|
|
1199
1199
|
"Required_type_parameters_may_not_follow_optional_type_parameters_2706": "必要型別參數可能未遵循選擇性型別參數。",
|
|
1200
1200
|
"Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "從位置 '{1}' 的快取中找到模組 '{0}' 的解析。",
|
|
1201
1201
|
"Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "從位置 '{0}' 的快取記憶體找到類型參照指示詞 '{1}'。",
|
|
1202
|
+
"Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125": "解析模式宣告不穩定。使用夜間 TypeScript 將此錯誤設為靜音。請嘗試使用 'npm install -D typescript@next' 更新。",
|
|
1202
1203
|
"Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452": "只有當 'moduleResolution' 為 'node16' 或 'nodenext' 時,才支援解析模式。",
|
|
1203
1204
|
"Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "只將 'keyof' 解析為字串值的屬性名稱 (無任何數字或符號)。",
|
|
1204
1205
|
"Resolving_module_0_from_1_6086": "======== 正在從 '{1}' 解析模組 '{0}'。========",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220512",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|