typescript 4.5.0-dev.20211024 → 4.5.0-dev.20211028
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/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/pl/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +137 -86
- package/lib/tsserver.js +144 -90
- package/lib/tsserverlibrary.js +144 -90
- package/lib/typescript.js +144 -90
- package/lib/typescriptServices.js +144 -90
- package/lib/typingsInstaller.js +142 -90
- 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.20211028";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -9332,6 +9332,7 @@ var ts;
|
|
|
9332
9332
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9333
9333
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9334
9334
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9335
|
+
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9335
9336
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9336
9337
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9337
9338
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -19628,6 +19629,8 @@ var ts;
|
|
|
19628
19629
|
case ts.ModuleKind.ES2020:
|
|
19629
19630
|
case ts.ModuleKind.ES2022:
|
|
19630
19631
|
case ts.ModuleKind.ESNext:
|
|
19632
|
+
case ts.ModuleKind.Node12:
|
|
19633
|
+
case ts.ModuleKind.NodeNext:
|
|
19631
19634
|
return true;
|
|
19632
19635
|
default:
|
|
19633
19636
|
return false;
|
|
@@ -48813,6 +48816,10 @@ var ts;
|
|
|
48813
48816
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
48814
48817
|
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
48815
48818
|
}
|
|
48819
|
+
function isOnlyImportedAsDefault(usage) {
|
|
48820
|
+
var usageMode = getUsageModeForExpression(usage);
|
|
48821
|
+
return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
|
|
48822
|
+
}
|
|
48816
48823
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
48817
48824
|
var usageMode = file && getUsageModeForExpression(usage);
|
|
48818
48825
|
if (file && usageMode !== undefined) {
|
|
@@ -48863,8 +48870,9 @@ var ts;
|
|
|
48863
48870
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
48864
48871
|
}
|
|
48865
48872
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
48873
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
|
|
48866
48874
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
48867
|
-
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
48875
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
48868
48876
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
48869
48877
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48870
48878
|
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
@@ -48878,7 +48886,7 @@ var ts;
|
|
|
48878
48886
|
reportNonDefaultExport(moduleSymbol, node);
|
|
48879
48887
|
}
|
|
48880
48888
|
}
|
|
48881
|
-
else if (hasSyntheticDefault) {
|
|
48889
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
48882
48890
|
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
48883
48891
|
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48884
48892
|
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
@@ -49003,7 +49011,7 @@ var ts;
|
|
|
49003
49011
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
49004
49012
|
if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
|
|
49005
49013
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49006
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49014
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49007
49015
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49008
49016
|
}
|
|
49009
49017
|
}
|
|
@@ -49397,21 +49405,28 @@ var ts;
|
|
|
49397
49405
|
var namespaceName = getFullyQualifiedName(namespace);
|
|
49398
49406
|
var declarationName = ts.declarationNameToString(right);
|
|
49399
49407
|
var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
49400
|
-
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49401
|
-
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49402
|
-
var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49403
49408
|
if (suggestionForNonexistentModule) {
|
|
49404
49409
|
error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
49410
|
+
return undefined;
|
|
49405
49411
|
}
|
|
49406
|
-
|
|
49412
|
+
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49413
|
+
var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
|
|
49414
|
+
&& (meaning & 788968 /* Type */)
|
|
49415
|
+
&& containingQualifiedName
|
|
49416
|
+
&& !ts.isTypeOfExpression(containingQualifiedName.parent)
|
|
49417
|
+
&& tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49418
|
+
if (canSuggestTypeof) {
|
|
49407
49419
|
error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
|
|
49420
|
+
return undefined;
|
|
49408
49421
|
}
|
|
49409
|
-
|
|
49410
|
-
|
|
49411
|
-
|
|
49412
|
-
|
|
49413
|
-
|
|
49422
|
+
if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
|
|
49423
|
+
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49424
|
+
if (exportedTypeSymbol) {
|
|
49425
|
+
error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
|
|
49426
|
+
return undefined;
|
|
49427
|
+
}
|
|
49414
49428
|
}
|
|
49429
|
+
error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
49415
49430
|
}
|
|
49416
49431
|
return undefined;
|
|
49417
49432
|
}
|
|
@@ -49547,6 +49562,9 @@ var ts;
|
|
|
49547
49562
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49548
49563
|
error(errorNode, ts.Diagnostics.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, moduleReference);
|
|
49549
49564
|
}
|
|
49565
|
+
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
49566
|
+
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
49567
|
+
}
|
|
49550
49568
|
}
|
|
49551
49569
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49552
49570
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -49685,40 +49703,50 @@ var ts;
|
|
|
49685
49703
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
49686
49704
|
return symbol;
|
|
49687
49705
|
}
|
|
49688
|
-
|
|
49689
|
-
|
|
49690
|
-
|
|
49691
|
-
|
|
49692
|
-
|
|
49706
|
+
var referenceParent = referencingLocation.parent;
|
|
49707
|
+
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49708
|
+
ts.isImportCall(referenceParent)) {
|
|
49709
|
+
var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
|
49710
|
+
var type = getTypeOfSymbol(symbol);
|
|
49711
|
+
var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
|
49712
|
+
if (defaultOnlyType) {
|
|
49713
|
+
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
49714
|
+
}
|
|
49715
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
49693
49716
|
var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
49694
49717
|
if (!sigs || !sigs.length) {
|
|
49695
49718
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49696
49719
|
}
|
|
49697
|
-
if (sigs && sigs.length) {
|
|
49698
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol,
|
|
49699
|
-
|
|
49700
|
-
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49701
|
-
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49702
|
-
result.parent = symbol.parent;
|
|
49703
|
-
result.target = symbol;
|
|
49704
|
-
result.originatingImport = referenceParent;
|
|
49705
|
-
if (symbol.valueDeclaration)
|
|
49706
|
-
result.valueDeclaration = symbol.valueDeclaration;
|
|
49707
|
-
if (symbol.constEnumOnlyModule)
|
|
49708
|
-
result.constEnumOnlyModule = true;
|
|
49709
|
-
if (symbol.members)
|
|
49710
|
-
result.members = new ts.Map(symbol.members);
|
|
49711
|
-
if (symbol.exports)
|
|
49712
|
-
result.exports = new ts.Map(symbol.exports);
|
|
49713
|
-
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49714
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49715
|
-
return result;
|
|
49720
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49721
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49722
|
+
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49716
49723
|
}
|
|
49717
49724
|
}
|
|
49718
49725
|
}
|
|
49719
49726
|
}
|
|
49720
49727
|
return symbol;
|
|
49721
49728
|
}
|
|
49729
|
+
/**
|
|
49730
|
+
* Create a new symbol which has the module's type less the call and construct signatures
|
|
49731
|
+
*/
|
|
49732
|
+
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
|
49733
|
+
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49734
|
+
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49735
|
+
result.parent = symbol.parent;
|
|
49736
|
+
result.target = symbol;
|
|
49737
|
+
result.originatingImport = referenceParent;
|
|
49738
|
+
if (symbol.valueDeclaration)
|
|
49739
|
+
result.valueDeclaration = symbol.valueDeclaration;
|
|
49740
|
+
if (symbol.constEnumOnlyModule)
|
|
49741
|
+
result.constEnumOnlyModule = true;
|
|
49742
|
+
if (symbol.members)
|
|
49743
|
+
result.members = new ts.Map(symbol.members);
|
|
49744
|
+
if (symbol.exports)
|
|
49745
|
+
result.exports = new ts.Map(symbol.exports);
|
|
49746
|
+
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49747
|
+
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49748
|
+
return result;
|
|
49749
|
+
}
|
|
49722
49750
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
49723
49751
|
return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
|
|
49724
49752
|
}
|
|
@@ -59324,7 +59352,7 @@ var ts;
|
|
|
59324
59352
|
var _loop_16 = function () {
|
|
59325
59353
|
i--;
|
|
59326
59354
|
var t = types[i];
|
|
59327
|
-
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return
|
|
59355
|
+
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
59328
59356
|
ts.orderedRemoveItemAt(types, i);
|
|
59329
59357
|
}
|
|
59330
59358
|
};
|
|
@@ -61517,7 +61545,8 @@ var ts;
|
|
|
61517
61545
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
61518
61546
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61519
61547
|
if (!type.declaration.nameType) {
|
|
61520
|
-
|
|
61548
|
+
var constraint = void 0;
|
|
61549
|
+
if (isArrayType(t) || (t.flags & 1 /* Any */) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61521
61550
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61522
61551
|
}
|
|
61523
61552
|
if (isGenericTupleType(t)) {
|
|
@@ -63057,13 +63086,12 @@ var ts;
|
|
|
63057
63086
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
63058
63087
|
var result = 0 /* False */;
|
|
63059
63088
|
var saveErrorInfo = captureErrorCalculationState();
|
|
63060
|
-
|
|
63061
|
-
|
|
63062
|
-
|
|
63063
|
-
|
|
63064
|
-
|
|
63065
|
-
|
|
63066
|
-
structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63089
|
+
if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
63090
|
+
// We skip caching when source or target is a union with no more than three constituents.
|
|
63091
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63092
|
+
}
|
|
63093
|
+
else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
|
|
63094
|
+
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
|
|
63067
63095
|
}
|
|
63068
63096
|
if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
|
|
63069
63097
|
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
@@ -63520,19 +63548,19 @@ var ts;
|
|
|
63520
63548
|
var maybeStart = maybeCount;
|
|
63521
63549
|
maybeKeys[maybeCount] = id;
|
|
63522
63550
|
maybeCount++;
|
|
63551
|
+
var saveExpandingFlags = expandingFlags;
|
|
63523
63552
|
if (recursionFlags & 1 /* Source */) {
|
|
63524
63553
|
sourceStack[sourceDepth] = source;
|
|
63525
63554
|
sourceDepth++;
|
|
63555
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63556
|
+
expandingFlags |= 1 /* Source */;
|
|
63526
63557
|
}
|
|
63527
63558
|
if (recursionFlags & 2 /* Target */) {
|
|
63528
63559
|
targetStack[targetDepth] = target;
|
|
63529
63560
|
targetDepth++;
|
|
63561
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63562
|
+
expandingFlags |= 2 /* Target */;
|
|
63530
63563
|
}
|
|
63531
|
-
var saveExpandingFlags = expandingFlags;
|
|
63532
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63533
|
-
expandingFlags |= 1 /* Source */;
|
|
63534
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63535
|
-
expandingFlags |= 2 /* Target */;
|
|
63536
63564
|
var originalHandler;
|
|
63537
63565
|
var propagatingVarianceFlags = 0;
|
|
63538
63566
|
if (outofbandVarianceMarkerHandler) {
|
|
@@ -63556,13 +63584,13 @@ var ts;
|
|
|
63556
63584
|
if (outofbandVarianceMarkerHandler) {
|
|
63557
63585
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
63558
63586
|
}
|
|
63559
|
-
expandingFlags = saveExpandingFlags;
|
|
63560
63587
|
if (recursionFlags & 1 /* Source */) {
|
|
63561
63588
|
sourceDepth--;
|
|
63562
63589
|
}
|
|
63563
63590
|
if (recursionFlags & 2 /* Target */) {
|
|
63564
63591
|
targetDepth--;
|
|
63565
63592
|
}
|
|
63593
|
+
expandingFlags = saveExpandingFlags;
|
|
63566
63594
|
if (result) {
|
|
63567
63595
|
if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
|
|
63568
63596
|
if (result === -1 /* True */ || result === 3 /* Maybe */) {
|
|
@@ -63900,8 +63928,7 @@ var ts;
|
|
|
63900
63928
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
63901
63929
|
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
|
|
63902
63930
|
}
|
|
63903
|
-
|
|
63904
|
-
if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
|
|
63931
|
+
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
63905
63932
|
return -1 /* True */;
|
|
63906
63933
|
}
|
|
63907
63934
|
}
|
|
@@ -64096,9 +64123,9 @@ var ts;
|
|
|
64096
64123
|
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
|
|
64097
64124
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
64098
64125
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
64099
|
-
var
|
|
64100
|
-
if (
|
|
64101
|
-
return
|
|
64126
|
+
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
64127
|
+
if (result_9) {
|
|
64128
|
+
return result_9;
|
|
64102
64129
|
}
|
|
64103
64130
|
}
|
|
64104
64131
|
}
|
|
@@ -64170,13 +64197,13 @@ var ts;
|
|
|
64170
64197
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
64171
64198
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
64172
64199
|
if (modifiersRelated) {
|
|
64173
|
-
var
|
|
64200
|
+
var result_10;
|
|
64174
64201
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
64175
64202
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
|
|
64176
|
-
if (
|
|
64203
|
+
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
64177
64204
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
64178
64205
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
64179
|
-
return
|
|
64206
|
+
return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
64180
64207
|
}
|
|
64181
64208
|
}
|
|
64182
64209
|
}
|
|
@@ -66259,6 +66286,10 @@ var ts;
|
|
|
66259
66286
|
inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
|
|
66260
66287
|
undefined;
|
|
66261
66288
|
}
|
|
66289
|
+
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
66290
|
+
var inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
66291
|
+
return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
|
|
66292
|
+
}
|
|
66262
66293
|
function getStringLikeTypeForType(type) {
|
|
66263
66294
|
return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
|
|
66264
66295
|
}
|
|
@@ -67162,8 +67193,11 @@ var ts;
|
|
|
67162
67193
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
67163
67194
|
switch (node.kind) {
|
|
67164
67195
|
case 79 /* Identifier */:
|
|
67165
|
-
|
|
67166
|
-
|
|
67196
|
+
if (!ts.isThisInTypeQuery(node)) {
|
|
67197
|
+
var symbol = getResolvedSymbol(node);
|
|
67198
|
+
return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
|
|
67199
|
+
}
|
|
67200
|
+
// falls through
|
|
67167
67201
|
case 108 /* ThisKeyword */:
|
|
67168
67202
|
return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
|
|
67169
67203
|
case 229 /* NonNullExpression */:
|
|
@@ -67794,7 +67828,7 @@ var ts;
|
|
|
67794
67828
|
mapType(type, mapper);
|
|
67795
67829
|
}
|
|
67796
67830
|
function getConstituentCount(type) {
|
|
67797
|
-
return type.flags &
|
|
67831
|
+
return type.flags & 1048576 /* Union */ ? type.types.length : 1;
|
|
67798
67832
|
}
|
|
67799
67833
|
function extractTypesOfKind(type, kind) {
|
|
67800
67834
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
@@ -69292,7 +69326,7 @@ var ts;
|
|
|
69292
69326
|
return parent.kind === 205 /* PropertyAccessExpression */ ||
|
|
69293
69327
|
parent.kind === 207 /* CallExpression */ && parent.expression === node ||
|
|
69294
69328
|
parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
|
|
69295
|
-
!(
|
|
69329
|
+
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
69296
69330
|
}
|
|
69297
69331
|
function isGenericTypeWithUnionConstraint(type) {
|
|
69298
69332
|
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
@@ -74892,11 +74926,33 @@ var ts;
|
|
|
74892
74926
|
if (moduleSymbol) {
|
|
74893
74927
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
|
|
74894
74928
|
if (esModuleSymbol) {
|
|
74895
|
-
return createPromiseReturnType(node,
|
|
74929
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
|
|
74930
|
+
getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
74896
74931
|
}
|
|
74897
74932
|
}
|
|
74898
74933
|
return createPromiseReturnType(node, anyType);
|
|
74899
74934
|
}
|
|
74935
|
+
function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
|
|
74936
|
+
var memberTable = ts.createSymbolTable();
|
|
74937
|
+
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74938
|
+
newSymbol.parent = originalSymbol;
|
|
74939
|
+
newSymbol.nameType = getStringLiteralType("default");
|
|
74940
|
+
newSymbol.target = resolveSymbol(symbol);
|
|
74941
|
+
memberTable.set("default" /* Default */, newSymbol);
|
|
74942
|
+
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
74943
|
+
}
|
|
74944
|
+
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74945
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
74946
|
+
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
74947
|
+
var synthType = type;
|
|
74948
|
+
if (!synthType.defaultOnlyType) {
|
|
74949
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
74950
|
+
synthType.defaultOnlyType = type_4;
|
|
74951
|
+
}
|
|
74952
|
+
return synthType.defaultOnlyType;
|
|
74953
|
+
}
|
|
74954
|
+
return undefined;
|
|
74955
|
+
}
|
|
74900
74956
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74901
74957
|
var _a;
|
|
74902
74958
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
@@ -74905,14 +74961,8 @@ var ts;
|
|
|
74905
74961
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
74906
74962
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
|
|
74907
74963
|
if (hasSyntheticDefault) {
|
|
74908
|
-
var memberTable = ts.createSymbolTable();
|
|
74909
|
-
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74910
|
-
newSymbol.parent = originalSymbol;
|
|
74911
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
74912
|
-
newSymbol.target = resolveSymbol(symbol);
|
|
74913
|
-
memberTable.set("default" /* Default */, newSymbol);
|
|
74914
74964
|
var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
74915
|
-
var defaultContainingObject =
|
|
74965
|
+
var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
74916
74966
|
anonymousSymbol.type = defaultContainingObject;
|
|
74917
74967
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
|
|
74918
74968
|
}
|
|
@@ -75620,12 +75670,12 @@ var ts;
|
|
|
75620
75670
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
75621
75671
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
75622
75672
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
75623
|
-
var
|
|
75673
|
+
var type_5 = getBaseConstraintOfType(operandType) || operandType;
|
|
75624
75674
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
75625
|
-
if (
|
|
75675
|
+
if (type_5.flags & 3 /* AnyOrUnknown */) {
|
|
75626
75676
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
75627
75677
|
}
|
|
75628
|
-
return !!(filterType(
|
|
75678
|
+
return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
75629
75679
|
}
|
|
75630
75680
|
var type = getTypeOfExpression(node.expression);
|
|
75631
75681
|
if (!isLiteralType(type)) {
|
|
@@ -78721,12 +78771,12 @@ var ts;
|
|
|
78721
78771
|
case 264 /* ImportEqualsDeclaration */:
|
|
78722
78772
|
case 267 /* NamespaceImport */:
|
|
78723
78773
|
case 266 /* ImportClause */:
|
|
78724
|
-
var
|
|
78774
|
+
var result_11 = 0 /* None */;
|
|
78725
78775
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
78726
78776
|
ts.forEach(target.declarations, function (d) {
|
|
78727
|
-
|
|
78777
|
+
result_11 |= getDeclarationSpaces(d);
|
|
78728
78778
|
});
|
|
78729
|
-
return
|
|
78779
|
+
return result_11;
|
|
78730
78780
|
case 253 /* VariableDeclaration */:
|
|
78731
78781
|
case 202 /* BindingElement */:
|
|
78732
78782
|
case 255 /* FunctionDeclaration */:
|
|
@@ -94899,8 +94949,8 @@ var ts;
|
|
|
94899
94949
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
94900
94950
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
94901
94951
|
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
94902
|
-
var
|
|
94903
|
-
return
|
|
94952
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
94953
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
94904
94954
|
}
|
|
94905
94955
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
94906
94956
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -113700,15 +113750,15 @@ var ts;
|
|
|
113700
113750
|
// which per above occurred during the current program creation.
|
|
113701
113751
|
// Since we assume the filesystem does not change during program creation,
|
|
113702
113752
|
// it is safe to reuse resolutions from the earlier call.
|
|
113703
|
-
var
|
|
113753
|
+
var result_13 = [];
|
|
113704
113754
|
var i = 0;
|
|
113705
113755
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113706
113756
|
var moduleName = moduleNames_1[_i];
|
|
113707
113757
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
113708
113758
|
i++;
|
|
113709
|
-
|
|
113759
|
+
result_13.push(resolvedModule);
|
|
113710
113760
|
}
|
|
113711
|
-
return
|
|
113761
|
+
return result_13;
|
|
113712
113762
|
}
|
|
113713
113763
|
// At this point, we know at least one of the following hold:
|
|
113714
113764
|
// - file has local declarations for ambient modules
|
|
@@ -115437,7 +115487,9 @@ var ts;
|
|
|
115437
115487
|
}
|
|
115438
115488
|
}
|
|
115439
115489
|
if (options.resolveJsonModule) {
|
|
115440
|
-
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs
|
|
115490
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
115491
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
|
|
115492
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
115441
115493
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
115442
115494
|
}
|
|
115443
115495
|
// Any emit other than common js, amd, es2015 or esnext is error
|
|
@@ -118770,9 +118822,9 @@ var ts;
|
|
|
118770
118822
|
if (!preferSymlinks) {
|
|
118771
118823
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
118772
118824
|
// so we only need to remove them from the realpath filenames.
|
|
118773
|
-
var
|
|
118774
|
-
if (
|
|
118775
|
-
return
|
|
118825
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
118826
|
+
if (result_14)
|
|
118827
|
+
return result_14;
|
|
118776
118828
|
}
|
|
118777
118829
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
118778
118830
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -118792,10 +118844,10 @@ var ts;
|
|
|
118792
118844
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
118793
118845
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
118794
118846
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
118795
|
-
var
|
|
118847
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
118796
118848
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
118797
|
-
if (
|
|
118798
|
-
return
|
|
118849
|
+
if (result_15)
|
|
118850
|
+
return result_15;
|
|
118799
118851
|
}
|
|
118800
118852
|
});
|
|
118801
118853
|
});
|
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.5.0-dev.
|
|
5
|
+
"version": "4.5.0-dev.20211028",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|