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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211028";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -9343,6 +9343,7 @@ var ts;
|
|
|
9343
9343
|
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."),
|
|
9344
9344
|
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."),
|
|
9345
9345
|
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."),
|
|
9346
|
+
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."),
|
|
9346
9347
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9347
9348
|
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."),
|
|
9348
9349
|
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."),
|
|
@@ -19639,6 +19640,8 @@ var ts;
|
|
|
19639
19640
|
case ts.ModuleKind.ES2020:
|
|
19640
19641
|
case ts.ModuleKind.ES2022:
|
|
19641
19642
|
case ts.ModuleKind.ESNext:
|
|
19643
|
+
case ts.ModuleKind.Node12:
|
|
19644
|
+
case ts.ModuleKind.NodeNext:
|
|
19642
19645
|
return true;
|
|
19643
19646
|
default:
|
|
19644
19647
|
return false;
|
|
@@ -48824,6 +48827,10 @@ var ts;
|
|
|
48824
48827
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
48825
48828
|
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
48826
48829
|
}
|
|
48830
|
+
function isOnlyImportedAsDefault(usage) {
|
|
48831
|
+
var usageMode = getUsageModeForExpression(usage);
|
|
48832
|
+
return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
|
|
48833
|
+
}
|
|
48827
48834
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
48828
48835
|
var usageMode = file && getUsageModeForExpression(usage);
|
|
48829
48836
|
if (file && usageMode !== undefined) {
|
|
@@ -48874,8 +48881,9 @@ var ts;
|
|
|
48874
48881
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
48875
48882
|
}
|
|
48876
48883
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
48884
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
|
|
48877
48885
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
48878
|
-
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
48886
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
48879
48887
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
48880
48888
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48881
48889
|
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
@@ -48889,7 +48897,7 @@ var ts;
|
|
|
48889
48897
|
reportNonDefaultExport(moduleSymbol, node);
|
|
48890
48898
|
}
|
|
48891
48899
|
}
|
|
48892
|
-
else if (hasSyntheticDefault) {
|
|
48900
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
48893
48901
|
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
48894
48902
|
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48895
48903
|
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
@@ -49014,7 +49022,7 @@ var ts;
|
|
|
49014
49022
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
49015
49023
|
if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
|
|
49016
49024
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49017
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49025
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49018
49026
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49019
49027
|
}
|
|
49020
49028
|
}
|
|
@@ -49408,21 +49416,28 @@ var ts;
|
|
|
49408
49416
|
var namespaceName = getFullyQualifiedName(namespace);
|
|
49409
49417
|
var declarationName = ts.declarationNameToString(right);
|
|
49410
49418
|
var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
49411
|
-
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49412
|
-
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49413
|
-
var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49414
49419
|
if (suggestionForNonexistentModule) {
|
|
49415
49420
|
error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
49421
|
+
return undefined;
|
|
49416
49422
|
}
|
|
49417
|
-
|
|
49423
|
+
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49424
|
+
var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
|
|
49425
|
+
&& (meaning & 788968 /* Type */)
|
|
49426
|
+
&& containingQualifiedName
|
|
49427
|
+
&& !ts.isTypeOfExpression(containingQualifiedName.parent)
|
|
49428
|
+
&& tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49429
|
+
if (canSuggestTypeof) {
|
|
49418
49430
|
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));
|
|
49431
|
+
return undefined;
|
|
49419
49432
|
}
|
|
49420
|
-
|
|
49421
|
-
|
|
49422
|
-
|
|
49423
|
-
|
|
49424
|
-
|
|
49433
|
+
if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
|
|
49434
|
+
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49435
|
+
if (exportedTypeSymbol) {
|
|
49436
|
+
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));
|
|
49437
|
+
return undefined;
|
|
49438
|
+
}
|
|
49425
49439
|
}
|
|
49440
|
+
error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
49426
49441
|
}
|
|
49427
49442
|
return undefined;
|
|
49428
49443
|
}
|
|
@@ -49558,6 +49573,9 @@ var ts;
|
|
|
49558
49573
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49559
49574
|
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);
|
|
49560
49575
|
}
|
|
49576
|
+
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
49577
|
+
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
49578
|
+
}
|
|
49561
49579
|
}
|
|
49562
49580
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49563
49581
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -49696,40 +49714,50 @@ var ts;
|
|
|
49696
49714
|
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);
|
|
49697
49715
|
return symbol;
|
|
49698
49716
|
}
|
|
49699
|
-
|
|
49700
|
-
|
|
49701
|
-
|
|
49702
|
-
|
|
49703
|
-
|
|
49717
|
+
var referenceParent = referencingLocation.parent;
|
|
49718
|
+
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49719
|
+
ts.isImportCall(referenceParent)) {
|
|
49720
|
+
var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
|
49721
|
+
var type = getTypeOfSymbol(symbol);
|
|
49722
|
+
var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
|
49723
|
+
if (defaultOnlyType) {
|
|
49724
|
+
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
49725
|
+
}
|
|
49726
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
49704
49727
|
var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
49705
49728
|
if (!sigs || !sigs.length) {
|
|
49706
49729
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49707
49730
|
}
|
|
49708
|
-
if (sigs && sigs.length) {
|
|
49709
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol,
|
|
49710
|
-
|
|
49711
|
-
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49712
|
-
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49713
|
-
result.parent = symbol.parent;
|
|
49714
|
-
result.target = symbol;
|
|
49715
|
-
result.originatingImport = referenceParent;
|
|
49716
|
-
if (symbol.valueDeclaration)
|
|
49717
|
-
result.valueDeclaration = symbol.valueDeclaration;
|
|
49718
|
-
if (symbol.constEnumOnlyModule)
|
|
49719
|
-
result.constEnumOnlyModule = true;
|
|
49720
|
-
if (symbol.members)
|
|
49721
|
-
result.members = new ts.Map(symbol.members);
|
|
49722
|
-
if (symbol.exports)
|
|
49723
|
-
result.exports = new ts.Map(symbol.exports);
|
|
49724
|
-
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49725
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49726
|
-
return result;
|
|
49731
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49732
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49733
|
+
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49727
49734
|
}
|
|
49728
49735
|
}
|
|
49729
49736
|
}
|
|
49730
49737
|
}
|
|
49731
49738
|
return symbol;
|
|
49732
49739
|
}
|
|
49740
|
+
/**
|
|
49741
|
+
* Create a new symbol which has the module's type less the call and construct signatures
|
|
49742
|
+
*/
|
|
49743
|
+
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
|
49744
|
+
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49745
|
+
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49746
|
+
result.parent = symbol.parent;
|
|
49747
|
+
result.target = symbol;
|
|
49748
|
+
result.originatingImport = referenceParent;
|
|
49749
|
+
if (symbol.valueDeclaration)
|
|
49750
|
+
result.valueDeclaration = symbol.valueDeclaration;
|
|
49751
|
+
if (symbol.constEnumOnlyModule)
|
|
49752
|
+
result.constEnumOnlyModule = true;
|
|
49753
|
+
if (symbol.members)
|
|
49754
|
+
result.members = new ts.Map(symbol.members);
|
|
49755
|
+
if (symbol.exports)
|
|
49756
|
+
result.exports = new ts.Map(symbol.exports);
|
|
49757
|
+
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49758
|
+
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49759
|
+
return result;
|
|
49760
|
+
}
|
|
49733
49761
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
49734
49762
|
return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
|
|
49735
49763
|
}
|
|
@@ -59335,7 +59363,7 @@ var ts;
|
|
|
59335
59363
|
var _loop_16 = function () {
|
|
59336
59364
|
i--;
|
|
59337
59365
|
var t = types[i];
|
|
59338
|
-
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return
|
|
59366
|
+
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
59339
59367
|
ts.orderedRemoveItemAt(types, i);
|
|
59340
59368
|
}
|
|
59341
59369
|
};
|
|
@@ -61528,7 +61556,8 @@ var ts;
|
|
|
61528
61556
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
61529
61557
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61530
61558
|
if (!type.declaration.nameType) {
|
|
61531
|
-
|
|
61559
|
+
var constraint = void 0;
|
|
61560
|
+
if (isArrayType(t) || (t.flags & 1 /* Any */) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61532
61561
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61533
61562
|
}
|
|
61534
61563
|
if (isGenericTupleType(t)) {
|
|
@@ -63068,13 +63097,12 @@ var ts;
|
|
|
63068
63097
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
63069
63098
|
var result = 0 /* False */;
|
|
63070
63099
|
var saveErrorInfo = captureErrorCalculationState();
|
|
63071
|
-
|
|
63072
|
-
|
|
63073
|
-
|
|
63074
|
-
|
|
63075
|
-
|
|
63076
|
-
|
|
63077
|
-
structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63100
|
+
if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
63101
|
+
// We skip caching when source or target is a union with no more than three constituents.
|
|
63102
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63103
|
+
}
|
|
63104
|
+
else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
|
|
63105
|
+
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
|
|
63078
63106
|
}
|
|
63079
63107
|
if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
|
|
63080
63108
|
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
@@ -63531,19 +63559,19 @@ var ts;
|
|
|
63531
63559
|
var maybeStart = maybeCount;
|
|
63532
63560
|
maybeKeys[maybeCount] = id;
|
|
63533
63561
|
maybeCount++;
|
|
63562
|
+
var saveExpandingFlags = expandingFlags;
|
|
63534
63563
|
if (recursionFlags & 1 /* Source */) {
|
|
63535
63564
|
sourceStack[sourceDepth] = source;
|
|
63536
63565
|
sourceDepth++;
|
|
63566
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63567
|
+
expandingFlags |= 1 /* Source */;
|
|
63537
63568
|
}
|
|
63538
63569
|
if (recursionFlags & 2 /* Target */) {
|
|
63539
63570
|
targetStack[targetDepth] = target;
|
|
63540
63571
|
targetDepth++;
|
|
63572
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63573
|
+
expandingFlags |= 2 /* Target */;
|
|
63541
63574
|
}
|
|
63542
|
-
var saveExpandingFlags = expandingFlags;
|
|
63543
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63544
|
-
expandingFlags |= 1 /* Source */;
|
|
63545
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63546
|
-
expandingFlags |= 2 /* Target */;
|
|
63547
63575
|
var originalHandler;
|
|
63548
63576
|
var propagatingVarianceFlags = 0;
|
|
63549
63577
|
if (outofbandVarianceMarkerHandler) {
|
|
@@ -63567,13 +63595,13 @@ var ts;
|
|
|
63567
63595
|
if (outofbandVarianceMarkerHandler) {
|
|
63568
63596
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
63569
63597
|
}
|
|
63570
|
-
expandingFlags = saveExpandingFlags;
|
|
63571
63598
|
if (recursionFlags & 1 /* Source */) {
|
|
63572
63599
|
sourceDepth--;
|
|
63573
63600
|
}
|
|
63574
63601
|
if (recursionFlags & 2 /* Target */) {
|
|
63575
63602
|
targetDepth--;
|
|
63576
63603
|
}
|
|
63604
|
+
expandingFlags = saveExpandingFlags;
|
|
63577
63605
|
if (result) {
|
|
63578
63606
|
if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
|
|
63579
63607
|
if (result === -1 /* True */ || result === 3 /* Maybe */) {
|
|
@@ -63911,8 +63939,7 @@ var ts;
|
|
|
63911
63939
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
63912
63940
|
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
|
|
63913
63941
|
}
|
|
63914
|
-
|
|
63915
|
-
if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
|
|
63942
|
+
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
63916
63943
|
return -1 /* True */;
|
|
63917
63944
|
}
|
|
63918
63945
|
}
|
|
@@ -64107,9 +64134,9 @@ var ts;
|
|
|
64107
64134
|
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
|
|
64108
64135
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
64109
64136
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
64110
|
-
var
|
|
64111
|
-
if (
|
|
64112
|
-
return
|
|
64137
|
+
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
64138
|
+
if (result_9) {
|
|
64139
|
+
return result_9;
|
|
64113
64140
|
}
|
|
64114
64141
|
}
|
|
64115
64142
|
}
|
|
@@ -64181,13 +64208,13 @@ var ts;
|
|
|
64181
64208
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
64182
64209
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
64183
64210
|
if (modifiersRelated) {
|
|
64184
|
-
var
|
|
64211
|
+
var result_10;
|
|
64185
64212
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
64186
64213
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
|
|
64187
|
-
if (
|
|
64214
|
+
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
64188
64215
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
64189
64216
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
64190
|
-
return
|
|
64217
|
+
return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
64191
64218
|
}
|
|
64192
64219
|
}
|
|
64193
64220
|
}
|
|
@@ -66270,6 +66297,10 @@ var ts;
|
|
|
66270
66297
|
inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
|
|
66271
66298
|
undefined;
|
|
66272
66299
|
}
|
|
66300
|
+
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
66301
|
+
var inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
66302
|
+
return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
|
|
66303
|
+
}
|
|
66273
66304
|
function getStringLikeTypeForType(type) {
|
|
66274
66305
|
return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
|
|
66275
66306
|
}
|
|
@@ -67173,8 +67204,11 @@ var ts;
|
|
|
67173
67204
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
67174
67205
|
switch (node.kind) {
|
|
67175
67206
|
case 79 /* Identifier */:
|
|
67176
|
-
|
|
67177
|
-
|
|
67207
|
+
if (!ts.isThisInTypeQuery(node)) {
|
|
67208
|
+
var symbol = getResolvedSymbol(node);
|
|
67209
|
+
return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
|
|
67210
|
+
}
|
|
67211
|
+
// falls through
|
|
67178
67212
|
case 108 /* ThisKeyword */:
|
|
67179
67213
|
return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
|
|
67180
67214
|
case 229 /* NonNullExpression */:
|
|
@@ -67805,7 +67839,7 @@ var ts;
|
|
|
67805
67839
|
mapType(type, mapper);
|
|
67806
67840
|
}
|
|
67807
67841
|
function getConstituentCount(type) {
|
|
67808
|
-
return type.flags &
|
|
67842
|
+
return type.flags & 1048576 /* Union */ ? type.types.length : 1;
|
|
67809
67843
|
}
|
|
67810
67844
|
function extractTypesOfKind(type, kind) {
|
|
67811
67845
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
@@ -69303,7 +69337,7 @@ var ts;
|
|
|
69303
69337
|
return parent.kind === 205 /* PropertyAccessExpression */ ||
|
|
69304
69338
|
parent.kind === 207 /* CallExpression */ && parent.expression === node ||
|
|
69305
69339
|
parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
|
|
69306
|
-
!(
|
|
69340
|
+
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
69307
69341
|
}
|
|
69308
69342
|
function isGenericTypeWithUnionConstraint(type) {
|
|
69309
69343
|
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
@@ -74903,11 +74937,33 @@ var ts;
|
|
|
74903
74937
|
if (moduleSymbol) {
|
|
74904
74938
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
|
|
74905
74939
|
if (esModuleSymbol) {
|
|
74906
|
-
return createPromiseReturnType(node,
|
|
74940
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
|
|
74941
|
+
getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
74907
74942
|
}
|
|
74908
74943
|
}
|
|
74909
74944
|
return createPromiseReturnType(node, anyType);
|
|
74910
74945
|
}
|
|
74946
|
+
function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
|
|
74947
|
+
var memberTable = ts.createSymbolTable();
|
|
74948
|
+
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74949
|
+
newSymbol.parent = originalSymbol;
|
|
74950
|
+
newSymbol.nameType = getStringLiteralType("default");
|
|
74951
|
+
newSymbol.target = resolveSymbol(symbol);
|
|
74952
|
+
memberTable.set("default" /* Default */, newSymbol);
|
|
74953
|
+
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
74954
|
+
}
|
|
74955
|
+
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74956
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
74957
|
+
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
74958
|
+
var synthType = type;
|
|
74959
|
+
if (!synthType.defaultOnlyType) {
|
|
74960
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
74961
|
+
synthType.defaultOnlyType = type_4;
|
|
74962
|
+
}
|
|
74963
|
+
return synthType.defaultOnlyType;
|
|
74964
|
+
}
|
|
74965
|
+
return undefined;
|
|
74966
|
+
}
|
|
74911
74967
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74912
74968
|
var _a;
|
|
74913
74969
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
@@ -74916,14 +74972,8 @@ var ts;
|
|
|
74916
74972
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
74917
74973
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
|
|
74918
74974
|
if (hasSyntheticDefault) {
|
|
74919
|
-
var memberTable = ts.createSymbolTable();
|
|
74920
|
-
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74921
|
-
newSymbol.parent = originalSymbol;
|
|
74922
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
74923
|
-
newSymbol.target = resolveSymbol(symbol);
|
|
74924
|
-
memberTable.set("default" /* Default */, newSymbol);
|
|
74925
74975
|
var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
74926
|
-
var defaultContainingObject =
|
|
74976
|
+
var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
74927
74977
|
anonymousSymbol.type = defaultContainingObject;
|
|
74928
74978
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
|
|
74929
74979
|
}
|
|
@@ -75631,12 +75681,12 @@ var ts;
|
|
|
75631
75681
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
75632
75682
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
75633
75683
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
75634
|
-
var
|
|
75684
|
+
var type_5 = getBaseConstraintOfType(operandType) || operandType;
|
|
75635
75685
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
75636
|
-
if (
|
|
75686
|
+
if (type_5.flags & 3 /* AnyOrUnknown */) {
|
|
75637
75687
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
75638
75688
|
}
|
|
75639
|
-
return !!(filterType(
|
|
75689
|
+
return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
75640
75690
|
}
|
|
75641
75691
|
var type = getTypeOfExpression(node.expression);
|
|
75642
75692
|
if (!isLiteralType(type)) {
|
|
@@ -78732,12 +78782,12 @@ var ts;
|
|
|
78732
78782
|
case 264 /* ImportEqualsDeclaration */:
|
|
78733
78783
|
case 267 /* NamespaceImport */:
|
|
78734
78784
|
case 266 /* ImportClause */:
|
|
78735
|
-
var
|
|
78785
|
+
var result_11 = 0 /* None */;
|
|
78736
78786
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
78737
78787
|
ts.forEach(target.declarations, function (d) {
|
|
78738
|
-
|
|
78788
|
+
result_11 |= getDeclarationSpaces(d);
|
|
78739
78789
|
});
|
|
78740
|
-
return
|
|
78790
|
+
return result_11;
|
|
78741
78791
|
case 253 /* VariableDeclaration */:
|
|
78742
78792
|
case 202 /* BindingElement */:
|
|
78743
78793
|
case 255 /* FunctionDeclaration */:
|
|
@@ -94910,8 +94960,8 @@ var ts;
|
|
|
94910
94960
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
94911
94961
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
94912
94962
|
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
94913
|
-
var
|
|
94914
|
-
return
|
|
94963
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
94964
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
94915
94965
|
}
|
|
94916
94966
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
94917
94967
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -113711,15 +113761,15 @@ var ts;
|
|
|
113711
113761
|
// which per above occurred during the current program creation.
|
|
113712
113762
|
// Since we assume the filesystem does not change during program creation,
|
|
113713
113763
|
// it is safe to reuse resolutions from the earlier call.
|
|
113714
|
-
var
|
|
113764
|
+
var result_13 = [];
|
|
113715
113765
|
var i = 0;
|
|
113716
113766
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113717
113767
|
var moduleName = moduleNames_1[_i];
|
|
113718
113768
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
113719
113769
|
i++;
|
|
113720
|
-
|
|
113770
|
+
result_13.push(resolvedModule);
|
|
113721
113771
|
}
|
|
113722
|
-
return
|
|
113772
|
+
return result_13;
|
|
113723
113773
|
}
|
|
113724
113774
|
// At this point, we know at least one of the following hold:
|
|
113725
113775
|
// - file has local declarations for ambient modules
|
|
@@ -115448,7 +115498,9 @@ var ts;
|
|
|
115448
115498
|
}
|
|
115449
115499
|
}
|
|
115450
115500
|
if (options.resolveJsonModule) {
|
|
115451
|
-
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs
|
|
115501
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
115502
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
|
|
115503
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
115452
115504
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
115453
115505
|
}
|
|
115454
115506
|
// Any emit other than common js, amd, es2015 or esnext is error
|
|
@@ -118781,9 +118833,9 @@ var ts;
|
|
|
118781
118833
|
if (!preferSymlinks) {
|
|
118782
118834
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
118783
118835
|
// so we only need to remove them from the realpath filenames.
|
|
118784
|
-
var
|
|
118785
|
-
if (
|
|
118786
|
-
return
|
|
118836
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
118837
|
+
if (result_14)
|
|
118838
|
+
return result_14;
|
|
118787
118839
|
}
|
|
118788
118840
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
118789
118841
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -118803,10 +118855,10 @@ var ts;
|
|
|
118803
118855
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
118804
118856
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
118805
118857
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
118806
|
-
var
|
|
118858
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
118807
118859
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
118808
|
-
if (
|
|
118809
|
-
return
|
|
118860
|
+
if (result_15)
|
|
118861
|
+
return result_15;
|
|
118810
118862
|
}
|
|
118811
118863
|
});
|
|
118812
118864
|
});
|
|
@@ -129611,6 +129663,8 @@ var ts;
|
|
|
129611
129663
|
case 131 /* AsyncKeyword */:
|
|
129612
129664
|
return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
|
|
129613
129665
|
|| containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
|
|
129666
|
+
case 41 /* AsteriskToken */:
|
|
129667
|
+
return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
|
|
129614
129668
|
}
|
|
129615
129669
|
if (isClassMemberCompletionKeyword(tokenKind)) {
|
|
129616
129670
|
return true;
|