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/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.20211028";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9537,6 +9537,7 @@ var ts;
|
|
|
9537
9537
|
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."),
|
|
9538
9538
|
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."),
|
|
9539
9539
|
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."),
|
|
9540
|
+
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."),
|
|
9540
9541
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9541
9542
|
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."),
|
|
9542
9543
|
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."),
|
|
@@ -19833,6 +19834,8 @@ var ts;
|
|
|
19833
19834
|
case ts.ModuleKind.ES2020:
|
|
19834
19835
|
case ts.ModuleKind.ES2022:
|
|
19835
19836
|
case ts.ModuleKind.ESNext:
|
|
19837
|
+
case ts.ModuleKind.Node12:
|
|
19838
|
+
case ts.ModuleKind.NodeNext:
|
|
19836
19839
|
return true;
|
|
19837
19840
|
default:
|
|
19838
19841
|
return false;
|
|
@@ -49018,6 +49021,10 @@ var ts;
|
|
|
49018
49021
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
49019
49022
|
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
49020
49023
|
}
|
|
49024
|
+
function isOnlyImportedAsDefault(usage) {
|
|
49025
|
+
var usageMode = getUsageModeForExpression(usage);
|
|
49026
|
+
return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
|
|
49027
|
+
}
|
|
49021
49028
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
49022
49029
|
var usageMode = file && getUsageModeForExpression(usage);
|
|
49023
49030
|
if (file && usageMode !== undefined) {
|
|
@@ -49068,8 +49075,9 @@ var ts;
|
|
|
49068
49075
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
49069
49076
|
}
|
|
49070
49077
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49078
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
|
|
49071
49079
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
49072
|
-
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
49080
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
49073
49081
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
49074
49082
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
49075
49083
|
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
@@ -49083,7 +49091,7 @@ var ts;
|
|
|
49083
49091
|
reportNonDefaultExport(moduleSymbol, node);
|
|
49084
49092
|
}
|
|
49085
49093
|
}
|
|
49086
|
-
else if (hasSyntheticDefault) {
|
|
49094
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
49087
49095
|
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
49088
49096
|
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49089
49097
|
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
@@ -49208,7 +49216,7 @@ var ts;
|
|
|
49208
49216
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
49209
49217
|
if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
|
|
49210
49218
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49211
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49219
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49212
49220
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49213
49221
|
}
|
|
49214
49222
|
}
|
|
@@ -49602,21 +49610,28 @@ var ts;
|
|
|
49602
49610
|
var namespaceName = getFullyQualifiedName(namespace);
|
|
49603
49611
|
var declarationName = ts.declarationNameToString(right);
|
|
49604
49612
|
var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
49605
|
-
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49606
|
-
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49607
|
-
var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49608
49613
|
if (suggestionForNonexistentModule) {
|
|
49609
49614
|
error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
49615
|
+
return undefined;
|
|
49610
49616
|
}
|
|
49611
|
-
|
|
49617
|
+
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49618
|
+
var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
|
|
49619
|
+
&& (meaning & 788968 /* Type */)
|
|
49620
|
+
&& containingQualifiedName
|
|
49621
|
+
&& !ts.isTypeOfExpression(containingQualifiedName.parent)
|
|
49622
|
+
&& tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49623
|
+
if (canSuggestTypeof) {
|
|
49612
49624
|
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));
|
|
49625
|
+
return undefined;
|
|
49613
49626
|
}
|
|
49614
|
-
|
|
49615
|
-
|
|
49616
|
-
|
|
49617
|
-
|
|
49618
|
-
|
|
49627
|
+
if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
|
|
49628
|
+
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49629
|
+
if (exportedTypeSymbol) {
|
|
49630
|
+
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));
|
|
49631
|
+
return undefined;
|
|
49632
|
+
}
|
|
49619
49633
|
}
|
|
49634
|
+
error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
49620
49635
|
}
|
|
49621
49636
|
return undefined;
|
|
49622
49637
|
}
|
|
@@ -49752,6 +49767,9 @@ var ts;
|
|
|
49752
49767
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49753
49768
|
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);
|
|
49754
49769
|
}
|
|
49770
|
+
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
49771
|
+
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
49772
|
+
}
|
|
49755
49773
|
}
|
|
49756
49774
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49757
49775
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -49890,40 +49908,50 @@ var ts;
|
|
|
49890
49908
|
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);
|
|
49891
49909
|
return symbol;
|
|
49892
49910
|
}
|
|
49893
|
-
|
|
49894
|
-
|
|
49895
|
-
|
|
49896
|
-
|
|
49897
|
-
|
|
49911
|
+
var referenceParent = referencingLocation.parent;
|
|
49912
|
+
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49913
|
+
ts.isImportCall(referenceParent)) {
|
|
49914
|
+
var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
|
49915
|
+
var type = getTypeOfSymbol(symbol);
|
|
49916
|
+
var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
|
49917
|
+
if (defaultOnlyType) {
|
|
49918
|
+
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
49919
|
+
}
|
|
49920
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
49898
49921
|
var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
49899
49922
|
if (!sigs || !sigs.length) {
|
|
49900
49923
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49901
49924
|
}
|
|
49902
|
-
if (sigs && sigs.length) {
|
|
49903
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol,
|
|
49904
|
-
|
|
49905
|
-
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49906
|
-
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49907
|
-
result.parent = symbol.parent;
|
|
49908
|
-
result.target = symbol;
|
|
49909
|
-
result.originatingImport = referenceParent;
|
|
49910
|
-
if (symbol.valueDeclaration)
|
|
49911
|
-
result.valueDeclaration = symbol.valueDeclaration;
|
|
49912
|
-
if (symbol.constEnumOnlyModule)
|
|
49913
|
-
result.constEnumOnlyModule = true;
|
|
49914
|
-
if (symbol.members)
|
|
49915
|
-
result.members = new ts.Map(symbol.members);
|
|
49916
|
-
if (symbol.exports)
|
|
49917
|
-
result.exports = new ts.Map(symbol.exports);
|
|
49918
|
-
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49919
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49920
|
-
return result;
|
|
49925
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49926
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49927
|
+
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49921
49928
|
}
|
|
49922
49929
|
}
|
|
49923
49930
|
}
|
|
49924
49931
|
}
|
|
49925
49932
|
return symbol;
|
|
49926
49933
|
}
|
|
49934
|
+
/**
|
|
49935
|
+
* Create a new symbol which has the module's type less the call and construct signatures
|
|
49936
|
+
*/
|
|
49937
|
+
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
|
49938
|
+
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49939
|
+
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49940
|
+
result.parent = symbol.parent;
|
|
49941
|
+
result.target = symbol;
|
|
49942
|
+
result.originatingImport = referenceParent;
|
|
49943
|
+
if (symbol.valueDeclaration)
|
|
49944
|
+
result.valueDeclaration = symbol.valueDeclaration;
|
|
49945
|
+
if (symbol.constEnumOnlyModule)
|
|
49946
|
+
result.constEnumOnlyModule = true;
|
|
49947
|
+
if (symbol.members)
|
|
49948
|
+
result.members = new ts.Map(symbol.members);
|
|
49949
|
+
if (symbol.exports)
|
|
49950
|
+
result.exports = new ts.Map(symbol.exports);
|
|
49951
|
+
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49952
|
+
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49953
|
+
return result;
|
|
49954
|
+
}
|
|
49927
49955
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
49928
49956
|
return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
|
|
49929
49957
|
}
|
|
@@ -59529,7 +59557,7 @@ var ts;
|
|
|
59529
59557
|
var _loop_16 = function () {
|
|
59530
59558
|
i--;
|
|
59531
59559
|
var t = types[i];
|
|
59532
|
-
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return
|
|
59560
|
+
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
59533
59561
|
ts.orderedRemoveItemAt(types, i);
|
|
59534
59562
|
}
|
|
59535
59563
|
};
|
|
@@ -61722,7 +61750,8 @@ var ts;
|
|
|
61722
61750
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
61723
61751
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61724
61752
|
if (!type.declaration.nameType) {
|
|
61725
|
-
|
|
61753
|
+
var constraint = void 0;
|
|
61754
|
+
if (isArrayType(t) || (t.flags & 1 /* Any */) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61726
61755
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61727
61756
|
}
|
|
61728
61757
|
if (isGenericTupleType(t)) {
|
|
@@ -63262,13 +63291,12 @@ var ts;
|
|
|
63262
63291
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
63263
63292
|
var result = 0 /* False */;
|
|
63264
63293
|
var saveErrorInfo = captureErrorCalculationState();
|
|
63265
|
-
|
|
63266
|
-
|
|
63267
|
-
|
|
63268
|
-
|
|
63269
|
-
|
|
63270
|
-
|
|
63271
|
-
structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63294
|
+
if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
63295
|
+
// We skip caching when source or target is a union with no more than three constituents.
|
|
63296
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63297
|
+
}
|
|
63298
|
+
else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
|
|
63299
|
+
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
|
|
63272
63300
|
}
|
|
63273
63301
|
if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
|
|
63274
63302
|
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
@@ -63725,19 +63753,19 @@ var ts;
|
|
|
63725
63753
|
var maybeStart = maybeCount;
|
|
63726
63754
|
maybeKeys[maybeCount] = id;
|
|
63727
63755
|
maybeCount++;
|
|
63756
|
+
var saveExpandingFlags = expandingFlags;
|
|
63728
63757
|
if (recursionFlags & 1 /* Source */) {
|
|
63729
63758
|
sourceStack[sourceDepth] = source;
|
|
63730
63759
|
sourceDepth++;
|
|
63760
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63761
|
+
expandingFlags |= 1 /* Source */;
|
|
63731
63762
|
}
|
|
63732
63763
|
if (recursionFlags & 2 /* Target */) {
|
|
63733
63764
|
targetStack[targetDepth] = target;
|
|
63734
63765
|
targetDepth++;
|
|
63766
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63767
|
+
expandingFlags |= 2 /* Target */;
|
|
63735
63768
|
}
|
|
63736
|
-
var saveExpandingFlags = expandingFlags;
|
|
63737
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63738
|
-
expandingFlags |= 1 /* Source */;
|
|
63739
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63740
|
-
expandingFlags |= 2 /* Target */;
|
|
63741
63769
|
var originalHandler;
|
|
63742
63770
|
var propagatingVarianceFlags = 0;
|
|
63743
63771
|
if (outofbandVarianceMarkerHandler) {
|
|
@@ -63761,13 +63789,13 @@ var ts;
|
|
|
63761
63789
|
if (outofbandVarianceMarkerHandler) {
|
|
63762
63790
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
63763
63791
|
}
|
|
63764
|
-
expandingFlags = saveExpandingFlags;
|
|
63765
63792
|
if (recursionFlags & 1 /* Source */) {
|
|
63766
63793
|
sourceDepth--;
|
|
63767
63794
|
}
|
|
63768
63795
|
if (recursionFlags & 2 /* Target */) {
|
|
63769
63796
|
targetDepth--;
|
|
63770
63797
|
}
|
|
63798
|
+
expandingFlags = saveExpandingFlags;
|
|
63771
63799
|
if (result) {
|
|
63772
63800
|
if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
|
|
63773
63801
|
if (result === -1 /* True */ || result === 3 /* Maybe */) {
|
|
@@ -64105,8 +64133,7 @@ var ts;
|
|
|
64105
64133
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
64106
64134
|
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
|
|
64107
64135
|
}
|
|
64108
|
-
|
|
64109
|
-
if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
|
|
64136
|
+
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
64110
64137
|
return -1 /* True */;
|
|
64111
64138
|
}
|
|
64112
64139
|
}
|
|
@@ -64301,9 +64328,9 @@ var ts;
|
|
|
64301
64328
|
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
|
|
64302
64329
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
64303
64330
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
64304
|
-
var
|
|
64305
|
-
if (
|
|
64306
|
-
return
|
|
64331
|
+
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
64332
|
+
if (result_9) {
|
|
64333
|
+
return result_9;
|
|
64307
64334
|
}
|
|
64308
64335
|
}
|
|
64309
64336
|
}
|
|
@@ -64375,13 +64402,13 @@ var ts;
|
|
|
64375
64402
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
64376
64403
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
64377
64404
|
if (modifiersRelated) {
|
|
64378
|
-
var
|
|
64405
|
+
var result_10;
|
|
64379
64406
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
64380
64407
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
|
|
64381
|
-
if (
|
|
64408
|
+
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
64382
64409
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
64383
64410
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
64384
|
-
return
|
|
64411
|
+
return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
64385
64412
|
}
|
|
64386
64413
|
}
|
|
64387
64414
|
}
|
|
@@ -66464,6 +66491,10 @@ var ts;
|
|
|
66464
66491
|
inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
|
|
66465
66492
|
undefined;
|
|
66466
66493
|
}
|
|
66494
|
+
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
66495
|
+
var inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
66496
|
+
return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
|
|
66497
|
+
}
|
|
66467
66498
|
function getStringLikeTypeForType(type) {
|
|
66468
66499
|
return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
|
|
66469
66500
|
}
|
|
@@ -67367,8 +67398,11 @@ var ts;
|
|
|
67367
67398
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
67368
67399
|
switch (node.kind) {
|
|
67369
67400
|
case 79 /* Identifier */:
|
|
67370
|
-
|
|
67371
|
-
|
|
67401
|
+
if (!ts.isThisInTypeQuery(node)) {
|
|
67402
|
+
var symbol = getResolvedSymbol(node);
|
|
67403
|
+
return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
|
|
67404
|
+
}
|
|
67405
|
+
// falls through
|
|
67372
67406
|
case 108 /* ThisKeyword */:
|
|
67373
67407
|
return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
|
|
67374
67408
|
case 229 /* NonNullExpression */:
|
|
@@ -67999,7 +68033,7 @@ var ts;
|
|
|
67999
68033
|
mapType(type, mapper);
|
|
68000
68034
|
}
|
|
68001
68035
|
function getConstituentCount(type) {
|
|
68002
|
-
return type.flags &
|
|
68036
|
+
return type.flags & 1048576 /* Union */ ? type.types.length : 1;
|
|
68003
68037
|
}
|
|
68004
68038
|
function extractTypesOfKind(type, kind) {
|
|
68005
68039
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
@@ -69497,7 +69531,7 @@ var ts;
|
|
|
69497
69531
|
return parent.kind === 205 /* PropertyAccessExpression */ ||
|
|
69498
69532
|
parent.kind === 207 /* CallExpression */ && parent.expression === node ||
|
|
69499
69533
|
parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
|
|
69500
|
-
!(
|
|
69534
|
+
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
69501
69535
|
}
|
|
69502
69536
|
function isGenericTypeWithUnionConstraint(type) {
|
|
69503
69537
|
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
@@ -75097,11 +75131,33 @@ var ts;
|
|
|
75097
75131
|
if (moduleSymbol) {
|
|
75098
75132
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
|
|
75099
75133
|
if (esModuleSymbol) {
|
|
75100
|
-
return createPromiseReturnType(node,
|
|
75134
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
|
|
75135
|
+
getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
75101
75136
|
}
|
|
75102
75137
|
}
|
|
75103
75138
|
return createPromiseReturnType(node, anyType);
|
|
75104
75139
|
}
|
|
75140
|
+
function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
|
|
75141
|
+
var memberTable = ts.createSymbolTable();
|
|
75142
|
+
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
75143
|
+
newSymbol.parent = originalSymbol;
|
|
75144
|
+
newSymbol.nameType = getStringLiteralType("default");
|
|
75145
|
+
newSymbol.target = resolveSymbol(symbol);
|
|
75146
|
+
memberTable.set("default" /* Default */, newSymbol);
|
|
75147
|
+
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
75148
|
+
}
|
|
75149
|
+
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75150
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75151
|
+
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75152
|
+
var synthType = type;
|
|
75153
|
+
if (!synthType.defaultOnlyType) {
|
|
75154
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
75155
|
+
synthType.defaultOnlyType = type_4;
|
|
75156
|
+
}
|
|
75157
|
+
return synthType.defaultOnlyType;
|
|
75158
|
+
}
|
|
75159
|
+
return undefined;
|
|
75160
|
+
}
|
|
75105
75161
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75106
75162
|
var _a;
|
|
75107
75163
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
@@ -75110,14 +75166,8 @@ var ts;
|
|
|
75110
75166
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
75111
75167
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
|
|
75112
75168
|
if (hasSyntheticDefault) {
|
|
75113
|
-
var memberTable = ts.createSymbolTable();
|
|
75114
|
-
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
75115
|
-
newSymbol.parent = originalSymbol;
|
|
75116
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
75117
|
-
newSymbol.target = resolveSymbol(symbol);
|
|
75118
|
-
memberTable.set("default" /* Default */, newSymbol);
|
|
75119
75169
|
var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
75120
|
-
var defaultContainingObject =
|
|
75170
|
+
var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
75121
75171
|
anonymousSymbol.type = defaultContainingObject;
|
|
75122
75172
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
|
|
75123
75173
|
}
|
|
@@ -75825,12 +75875,12 @@ var ts;
|
|
|
75825
75875
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
75826
75876
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
75827
75877
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
75828
|
-
var
|
|
75878
|
+
var type_5 = getBaseConstraintOfType(operandType) || operandType;
|
|
75829
75879
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
75830
|
-
if (
|
|
75880
|
+
if (type_5.flags & 3 /* AnyOrUnknown */) {
|
|
75831
75881
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
75832
75882
|
}
|
|
75833
|
-
return !!(filterType(
|
|
75883
|
+
return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
75834
75884
|
}
|
|
75835
75885
|
var type = getTypeOfExpression(node.expression);
|
|
75836
75886
|
if (!isLiteralType(type)) {
|
|
@@ -78926,12 +78976,12 @@ var ts;
|
|
|
78926
78976
|
case 264 /* ImportEqualsDeclaration */:
|
|
78927
78977
|
case 267 /* NamespaceImport */:
|
|
78928
78978
|
case 266 /* ImportClause */:
|
|
78929
|
-
var
|
|
78979
|
+
var result_11 = 0 /* None */;
|
|
78930
78980
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
78931
78981
|
ts.forEach(target.declarations, function (d) {
|
|
78932
|
-
|
|
78982
|
+
result_11 |= getDeclarationSpaces(d);
|
|
78933
78983
|
});
|
|
78934
|
-
return
|
|
78984
|
+
return result_11;
|
|
78935
78985
|
case 253 /* VariableDeclaration */:
|
|
78936
78986
|
case 202 /* BindingElement */:
|
|
78937
78987
|
case 255 /* FunctionDeclaration */:
|
|
@@ -95104,8 +95154,8 @@ var ts;
|
|
|
95104
95154
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95105
95155
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95106
95156
|
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95107
|
-
var
|
|
95108
|
-
return
|
|
95157
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95158
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95109
95159
|
}
|
|
95110
95160
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
95111
95161
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -113905,15 +113955,15 @@ var ts;
|
|
|
113905
113955
|
// which per above occurred during the current program creation.
|
|
113906
113956
|
// Since we assume the filesystem does not change during program creation,
|
|
113907
113957
|
// it is safe to reuse resolutions from the earlier call.
|
|
113908
|
-
var
|
|
113958
|
+
var result_13 = [];
|
|
113909
113959
|
var i = 0;
|
|
113910
113960
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113911
113961
|
var moduleName = moduleNames_1[_i];
|
|
113912
113962
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
113913
113963
|
i++;
|
|
113914
|
-
|
|
113964
|
+
result_13.push(resolvedModule);
|
|
113915
113965
|
}
|
|
113916
|
-
return
|
|
113966
|
+
return result_13;
|
|
113917
113967
|
}
|
|
113918
113968
|
// At this point, we know at least one of the following hold:
|
|
113919
113969
|
// - file has local declarations for ambient modules
|
|
@@ -115642,7 +115692,9 @@ var ts;
|
|
|
115642
115692
|
}
|
|
115643
115693
|
}
|
|
115644
115694
|
if (options.resolveJsonModule) {
|
|
115645
|
-
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs
|
|
115695
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
115696
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
|
|
115697
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
115646
115698
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
115647
115699
|
}
|
|
115648
115700
|
// Any emit other than common js, amd, es2015 or esnext is error
|
|
@@ -118975,9 +119027,9 @@ var ts;
|
|
|
118975
119027
|
if (!preferSymlinks) {
|
|
118976
119028
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
118977
119029
|
// so we only need to remove them from the realpath filenames.
|
|
118978
|
-
var
|
|
118979
|
-
if (
|
|
118980
|
-
return
|
|
119030
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
119031
|
+
if (result_14)
|
|
119032
|
+
return result_14;
|
|
118981
119033
|
}
|
|
118982
119034
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
118983
119035
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -118997,10 +119049,10 @@ var ts;
|
|
|
118997
119049
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
118998
119050
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
118999
119051
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
119000
|
-
var
|
|
119052
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
119001
119053
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
119002
|
-
if (
|
|
119003
|
-
return
|
|
119054
|
+
if (result_15)
|
|
119055
|
+
return result_15;
|
|
119004
119056
|
}
|
|
119005
119057
|
});
|
|
119006
119058
|
});
|
|
@@ -130193,6 +130245,8 @@ var ts;
|
|
|
130193
130245
|
case 131 /* AsyncKeyword */:
|
|
130194
130246
|
return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
|
|
130195
130247
|
|| containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
|
|
130248
|
+
case 41 /* AsteriskToken */:
|
|
130249
|
+
return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
|
|
130196
130250
|
}
|
|
130197
130251
|
if (isClassMemberCompletionKeyword(tokenKind)) {
|
|
130198
130252
|
return true;
|