mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
Update LKG.
This commit is contained in:
parent
88d867dc39
commit
2f876d9532
124
lib/tsc.js
124
lib/tsc.js
@ -4659,6 +4659,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -30734,7 +30736,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, false);
|
||||
if (accessibleResult.accessibility === 0) {
|
||||
var chain = lookupSymbolChainWorker(sym, context, meaning);
|
||||
@ -30751,6 +30753,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName);
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=");
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152) {
|
||||
@ -30903,7 +30909,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 512 : 0);
|
||||
if (symbol.flags & 16) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 &&
|
||||
symbol.flags & (2 | 1 | 4) &&
|
||||
symbol.escapedName !== "export=";
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288) {
|
||||
@ -30912,7 +30922,8 @@ var ts;
|
||||
if (symbol.flags & (2 | 1 | 4)
|
||||
&& symbol.escapedName !== "export="
|
||||
&& !(symbol.flags & 4194304)
|
||||
&& !(symbol.flags & 32)) {
|
||||
&& !(symbol.flags & 32)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384) {
|
||||
@ -30926,7 +30937,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 | 1024)) {
|
||||
if ((symbol.flags & (512 | 1024) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64) {
|
||||
@ -30952,7 +30963,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol);
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -31005,22 +31019,31 @@ var ts;
|
||||
var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.createHeritageClause(89, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b); }))];
|
||||
addResult(ts.createInterfaceDeclaration(undefined, undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
var mergedMembers = locationMap.get("merged") || ts.emptyArray;
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 | 67108864)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(undefined, undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export="; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(undefined, undefined, ts.createIdentifier(localName), nsBody, 16), 0);
|
||||
}
|
||||
@ -31170,6 +31193,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208:
|
||||
case 193:
|
||||
if (symbol.escapedName === "default" || symbol.escapedName === "export=") {
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
}
|
||||
@ -31177,8 +31201,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193:
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -31196,7 +31218,7 @@ var ts;
|
||||
var isExportAssignment = isExportEquals || isDefault;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, true);
|
||||
if (target) {
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
var expr = isExportAssignment ? ts.getExportAssignmentExpression(aliasDecl) : ts.getPropertyAssignmentAliasLikeExpression(aliasDecl);
|
||||
var first_1 = ts.isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : undefined;
|
||||
var referenced = first_1 && resolveEntityName(first_1, 67108863, true, true, enclosingDeclaration);
|
||||
@ -31248,6 +31270,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 | 32) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1)) &&
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -31482,11 +31505,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default") {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=") {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -31500,17 +31520,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" || localName === "__class" || localName === "__function") {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default") {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=") {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
}
|
||||
@ -31797,6 +31828,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -35128,13 +35161,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -35251,14 +35296,16 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -38066,7 +38113,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 && target.flags & 524288) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1);
|
||||
}
|
||||
@ -38383,7 +38430,7 @@ var ts;
|
||||
var isIntersectionConstituent = !!isApparentIntersectionConstituent;
|
||||
if (source.flags & 1048576) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068));
|
||||
}
|
||||
else {
|
||||
@ -38406,7 +38453,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else if (source.flags & 2097152) {
|
||||
result = someTypeRelatedToType(source, target, false, true);
|
||||
result = someTypeRelatedToType(source, target, false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 || target.flags & 66846720)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -38657,14 +38704,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 && containsType(sourceTypes, target)) {
|
||||
return -1;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -38733,7 +38780,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 && !(entry & 4)) {
|
||||
@ -39747,17 +39794,18 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
function forEachProperty(prop, callback) {
|
||||
if (ts.getCheckFlags(prop) & 6) {
|
||||
|
||||
129
lib/tsserver.js
129
lib/tsserver.js
@ -7026,6 +7026,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -32952,6 +32954,7 @@ var ts;
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 7] = "ResolvedTypeArguments";
|
||||
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
||||
var CheckMode;
|
||||
(function (CheckMode) {
|
||||
@ -37348,7 +37351,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeALiases*/ false);
|
||||
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
||||
// Lookup the root symbol of the chain of refs we'll use to access it and serialize it
|
||||
@ -37366,6 +37369,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames`
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
||||
@ -37557,7 +37564,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* Default */ : 0);
|
||||
if (symbol.flags & 16 /* Function */) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 /* Module */ &&
|
||||
symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
||||
symbol.escapedName !== "export=" /* ExportEquals */;
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 /* Function */ || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
@ -37568,7 +37579,8 @@ var ts;
|
||||
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */)
|
||||
&& symbol.escapedName !== "export=" /* ExportEquals */
|
||||
&& !(symbol.flags & 4194304 /* Prototype */)
|
||||
&& !(symbol.flags & 32 /* Class */)) {
|
||||
&& !(symbol.flags & 32 /* Class */)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384 /* Enum */) {
|
||||
@ -37585,7 +37597,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */)) {
|
||||
if ((symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
@ -37613,7 +37625,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -37672,8 +37687,14 @@ var ts;
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* Value */); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
// Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging)
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
@ -37683,17 +37704,20 @@ var ts;
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16 /* Function */));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export=" /* ExportEquals */; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
@ -37924,6 +37948,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208 /* BinaryExpression */:
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
@ -37934,10 +37959,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// A PAE alias is _always_ going to exist as an append to a top-level export, where our top level
|
||||
// handling should always be sufficient to encode the export action itself
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -37961,7 +37982,8 @@ var ts;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
// serialize what the alias points to, preserve the declaration's initializer
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
if (target) {
|
||||
// If the target resolves and resolves to a thing defined in this file, emit as an alias, otherwise emit as a const
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
// In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it
|
||||
// eg, `namespace A { export class B {} }; exports = A.B;`
|
||||
// Technically, this is all that's required in the case where the assignment is an entity name expression
|
||||
@ -38036,6 +38058,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0 /* String */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1 /* Number */) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -38309,11 +38332,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default" /* Default */) {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=" /* ExportEquals */) {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -38327,17 +38347,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216 /* InInitialEntityName */;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default" /* Default */) {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=" /* ExportEquals */) {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
// The result of this is going to be used as the symbol's name - lock it in, so `getUnusedName` will also pick it up
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
@ -38666,6 +38697,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6 /* JSDocTypeReference */:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7 /* ResolvedTypeArguments */:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -42472,13 +42505,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7 /* ResolvedTypeArguments */)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 /* TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -42617,14 +42662,17 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
// skip past entity names, eg `require("x").a.b.c`
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 /* ImportType */ || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -45747,7 +45795,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, /*isIntersectionConstituent*/ false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1 /* Succeeded */);
|
||||
}
|
||||
@ -46118,7 +46166,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@ -46156,7 +46204,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -46440,14 +46488,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -46535,7 +46583,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0 /* False */;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
||||
@ -47721,17 +47769,18 @@ var ts;
|
||||
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
||||
* For other cases, the types ids are used.
|
||||
*/
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
||||
// value that isn't undefined.
|
||||
|
||||
@ -7176,6 +7176,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -33102,6 +33104,7 @@ var ts;
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 7] = "ResolvedTypeArguments";
|
||||
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
||||
var CheckMode;
|
||||
(function (CheckMode) {
|
||||
@ -37498,7 +37501,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeALiases*/ false);
|
||||
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
||||
// Lookup the root symbol of the chain of refs we'll use to access it and serialize it
|
||||
@ -37516,6 +37519,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames`
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
||||
@ -37707,7 +37714,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* Default */ : 0);
|
||||
if (symbol.flags & 16 /* Function */) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 /* Module */ &&
|
||||
symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
||||
symbol.escapedName !== "export=" /* ExportEquals */;
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 /* Function */ || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
@ -37718,7 +37729,8 @@ var ts;
|
||||
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */)
|
||||
&& symbol.escapedName !== "export=" /* ExportEquals */
|
||||
&& !(symbol.flags & 4194304 /* Prototype */)
|
||||
&& !(symbol.flags & 32 /* Class */)) {
|
||||
&& !(symbol.flags & 32 /* Class */)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384 /* Enum */) {
|
||||
@ -37735,7 +37747,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */)) {
|
||||
if ((symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
@ -37763,7 +37775,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -37822,8 +37837,14 @@ var ts;
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* Value */); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
// Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging)
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
@ -37833,17 +37854,20 @@ var ts;
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16 /* Function */));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export=" /* ExportEquals */; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
@ -38074,6 +38098,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208 /* BinaryExpression */:
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
@ -38084,10 +38109,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// A PAE alias is _always_ going to exist as an append to a top-level export, where our top level
|
||||
// handling should always be sufficient to encode the export action itself
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -38111,7 +38132,8 @@ var ts;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
// serialize what the alias points to, preserve the declaration's initializer
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
if (target) {
|
||||
// If the target resolves and resolves to a thing defined in this file, emit as an alias, otherwise emit as a const
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
// In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it
|
||||
// eg, `namespace A { export class B {} }; exports = A.B;`
|
||||
// Technically, this is all that's required in the case where the assignment is an entity name expression
|
||||
@ -38186,6 +38208,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0 /* String */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1 /* Number */) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -38459,11 +38482,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default" /* Default */) {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=" /* ExportEquals */) {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -38477,17 +38497,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216 /* InInitialEntityName */;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default" /* Default */) {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=" /* ExportEquals */) {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
// The result of this is going to be used as the symbol's name - lock it in, so `getUnusedName` will also pick it up
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
@ -38816,6 +38847,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6 /* JSDocTypeReference */:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7 /* ResolvedTypeArguments */:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -42622,13 +42655,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7 /* ResolvedTypeArguments */)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 /* TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -42767,14 +42812,17 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
// skip past entity names, eg `require("x").a.b.c`
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 /* ImportType */ || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -45897,7 +45945,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, /*isIntersectionConstituent*/ false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1 /* Succeeded */);
|
||||
}
|
||||
@ -46268,7 +46316,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@ -46306,7 +46354,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -46590,14 +46638,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -46685,7 +46733,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0 /* False */;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
||||
@ -47871,17 +47919,18 @@ var ts;
|
||||
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
||||
* For other cases, the types ids are used.
|
||||
*/
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
||||
// value that isn't undefined.
|
||||
|
||||
@ -7165,6 +7165,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -33091,6 +33093,7 @@ var ts;
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 7] = "ResolvedTypeArguments";
|
||||
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
||||
var CheckMode;
|
||||
(function (CheckMode) {
|
||||
@ -37487,7 +37490,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeALiases*/ false);
|
||||
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
||||
// Lookup the root symbol of the chain of refs we'll use to access it and serialize it
|
||||
@ -37505,6 +37508,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames`
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
||||
@ -37696,7 +37703,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* Default */ : 0);
|
||||
if (symbol.flags & 16 /* Function */) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 /* Module */ &&
|
||||
symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
||||
symbol.escapedName !== "export=" /* ExportEquals */;
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 /* Function */ || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
@ -37707,7 +37718,8 @@ var ts;
|
||||
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */)
|
||||
&& symbol.escapedName !== "export=" /* ExportEquals */
|
||||
&& !(symbol.flags & 4194304 /* Prototype */)
|
||||
&& !(symbol.flags & 32 /* Class */)) {
|
||||
&& !(symbol.flags & 32 /* Class */)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384 /* Enum */) {
|
||||
@ -37724,7 +37736,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */)) {
|
||||
if ((symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
@ -37752,7 +37764,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -37811,8 +37826,14 @@ var ts;
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* Value */); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
// Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging)
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
@ -37822,17 +37843,20 @@ var ts;
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16 /* Function */));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export=" /* ExportEquals */; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
@ -38063,6 +38087,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208 /* BinaryExpression */:
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
@ -38073,10 +38098,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// A PAE alias is _always_ going to exist as an append to a top-level export, where our top level
|
||||
// handling should always be sufficient to encode the export action itself
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -38100,7 +38121,8 @@ var ts;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
// serialize what the alias points to, preserve the declaration's initializer
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
if (target) {
|
||||
// If the target resolves and resolves to a thing defined in this file, emit as an alias, otherwise emit as a const
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
// In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it
|
||||
// eg, `namespace A { export class B {} }; exports = A.B;`
|
||||
// Technically, this is all that's required in the case where the assignment is an entity name expression
|
||||
@ -38175,6 +38197,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0 /* String */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1 /* Number */) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -38448,11 +38471,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default" /* Default */) {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=" /* ExportEquals */) {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -38466,17 +38486,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216 /* InInitialEntityName */;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default" /* Default */) {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=" /* ExportEquals */) {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
// The result of this is going to be used as the symbol's name - lock it in, so `getUnusedName` will also pick it up
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
@ -38805,6 +38836,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6 /* JSDocTypeReference */:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7 /* ResolvedTypeArguments */:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -42611,13 +42644,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7 /* ResolvedTypeArguments */)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 /* TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -42756,14 +42801,17 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
// skip past entity names, eg `require("x").a.b.c`
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 /* ImportType */ || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -45886,7 +45934,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, /*isIntersectionConstituent*/ false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1 /* Succeeded */);
|
||||
}
|
||||
@ -46257,7 +46305,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@ -46295,7 +46343,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -46579,14 +46627,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -46674,7 +46722,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0 /* False */;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
||||
@ -47860,17 +47908,18 @@ var ts;
|
||||
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
||||
* For other cases, the types ids are used.
|
||||
*/
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
||||
// value that isn't undefined.
|
||||
|
||||
@ -7165,6 +7165,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -33091,6 +33093,7 @@ var ts;
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 7] = "ResolvedTypeArguments";
|
||||
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
||||
var CheckMode;
|
||||
(function (CheckMode) {
|
||||
@ -37487,7 +37490,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeALiases*/ false);
|
||||
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
||||
// Lookup the root symbol of the chain of refs we'll use to access it and serialize it
|
||||
@ -37505,6 +37508,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames`
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
||||
@ -37696,7 +37703,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* Default */ : 0);
|
||||
if (symbol.flags & 16 /* Function */) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 /* Module */ &&
|
||||
symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
||||
symbol.escapedName !== "export=" /* ExportEquals */;
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 /* Function */ || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
@ -37707,7 +37718,8 @@ var ts;
|
||||
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */)
|
||||
&& symbol.escapedName !== "export=" /* ExportEquals */
|
||||
&& !(symbol.flags & 4194304 /* Prototype */)
|
||||
&& !(symbol.flags & 32 /* Class */)) {
|
||||
&& !(symbol.flags & 32 /* Class */)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384 /* Enum */) {
|
||||
@ -37724,7 +37736,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */)) {
|
||||
if ((symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
@ -37752,7 +37764,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -37811,8 +37826,14 @@ var ts;
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* Value */); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
// Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging)
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
@ -37822,17 +37843,20 @@ var ts;
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16 /* Function */));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export=" /* ExportEquals */; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
@ -38063,6 +38087,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208 /* BinaryExpression */:
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
@ -38073,10 +38098,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// A PAE alias is _always_ going to exist as an append to a top-level export, where our top level
|
||||
// handling should always be sufficient to encode the export action itself
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -38100,7 +38121,8 @@ var ts;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
// serialize what the alias points to, preserve the declaration's initializer
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
if (target) {
|
||||
// If the target resolves and resolves to a thing defined in this file, emit as an alias, otherwise emit as a const
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
// In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it
|
||||
// eg, `namespace A { export class B {} }; exports = A.B;`
|
||||
// Technically, this is all that's required in the case where the assignment is an entity name expression
|
||||
@ -38175,6 +38197,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0 /* String */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1 /* Number */) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -38448,11 +38471,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default" /* Default */) {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=" /* ExportEquals */) {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -38466,17 +38486,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216 /* InInitialEntityName */;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default" /* Default */) {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=" /* ExportEquals */) {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
// The result of this is going to be used as the symbol's name - lock it in, so `getUnusedName` will also pick it up
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
@ -38805,6 +38836,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6 /* JSDocTypeReference */:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7 /* ResolvedTypeArguments */:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -42611,13 +42644,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7 /* ResolvedTypeArguments */)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 /* TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -42756,14 +42801,17 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
// skip past entity names, eg `require("x").a.b.c`
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 /* ImportType */ || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -45886,7 +45934,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, /*isIntersectionConstituent*/ false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1 /* Succeeded */);
|
||||
}
|
||||
@ -46257,7 +46305,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@ -46295,7 +46343,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -46579,14 +46627,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -46674,7 +46722,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0 /* False */;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
||||
@ -47860,17 +47908,18 @@ var ts;
|
||||
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
||||
* For other cases, the types ids are used.
|
||||
*/
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
||||
// value that isn't undefined.
|
||||
|
||||
@ -7015,6 +7015,8 @@ var ts;
|
||||
Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
|
||||
Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
|
||||
Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
|
||||
Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
|
||||
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
||||
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
||||
@ -32941,6 +32943,7 @@ var ts;
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
|
||||
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 7] = "ResolvedTypeArguments";
|
||||
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
||||
var CheckMode;
|
||||
(function (CheckMode) {
|
||||
@ -37337,7 +37340,7 @@ var ts;
|
||||
var visitedSymbols = ts.createMap();
|
||||
var deferredPrivates;
|
||||
var oldcontext = context;
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.mapMap(symbolTable, function (_symbol, name) { return [ts.unescapeLeadingUnderscores(name), true]; }), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
context = __assign(__assign({}, oldcontext), { usedSymbolNames: ts.createMap(), remappedSymbolNames: ts.createMap(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
|
||||
var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeALiases*/ false);
|
||||
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
||||
// Lookup the root symbol of the chain of refs we'll use to access it and serialize it
|
||||
@ -37355,6 +37358,10 @@ var ts;
|
||||
context.usedSymbolNames.set(name, true);
|
||||
});
|
||||
}
|
||||
ts.forEachEntry(symbolTable, function (symbol, name) {
|
||||
var baseName = ts.unescapeLeadingUnderscores(name);
|
||||
void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames`
|
||||
});
|
||||
var addingDeclare = !bundled;
|
||||
var exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
||||
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
||||
@ -37546,7 +37553,11 @@ var ts;
|
||||
isPrivate = true;
|
||||
}
|
||||
var modifierFlags = (!isPrivate ? 1 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* Default */ : 0);
|
||||
if (symbol.flags & 16 /* Function */) {
|
||||
var isConstMergedWithNS = symbol.flags & 1536 /* Module */ &&
|
||||
symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) &&
|
||||
symbol.escapedName !== "export=" /* ExportEquals */;
|
||||
var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
||||
if (symbol.flags & 16 /* Function */ || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 524288 /* TypeAlias */) {
|
||||
@ -37557,7 +37568,8 @@ var ts;
|
||||
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */)
|
||||
&& symbol.escapedName !== "export=" /* ExportEquals */
|
||||
&& !(symbol.flags & 4194304 /* Prototype */)
|
||||
&& !(symbol.flags & 32 /* Class */)) {
|
||||
&& !(symbol.flags & 32 /* Class */)
|
||||
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 384 /* Enum */) {
|
||||
@ -37574,7 +37586,7 @@ var ts;
|
||||
serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
|
||||
}
|
||||
}
|
||||
if (symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */)) {
|
||||
if ((symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
||||
serializeModule(symbol, symbolName, modifierFlags);
|
||||
}
|
||||
if (symbol.flags & 64 /* Interface */) {
|
||||
@ -37602,7 +37614,10 @@ var ts;
|
||||
}
|
||||
}
|
||||
function includePrivateSymbol(symbol) {
|
||||
if (ts.some(symbol.declarations, ts.isParameterDeclaration))
|
||||
return;
|
||||
ts.Debug.assertDefined(deferredPrivates);
|
||||
getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol); // Call to cache unique name for symbol
|
||||
deferredPrivates.set("" + getSymbolId(symbol), symbol);
|
||||
}
|
||||
function isExportingScope(enclosingDeclaration) {
|
||||
@ -37661,8 +37676,14 @@ var ts;
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArrays(indexSignatures, constructSignatures, callSignatures, members)), modifierFlags);
|
||||
}
|
||||
function getNamespaceMembersForSerialization(symbol) {
|
||||
return !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
}
|
||||
function isTypeOnlyNamespace(symbol) {
|
||||
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* Value */); });
|
||||
}
|
||||
function serializeModule(symbol, symbolName, modifierFlags) {
|
||||
var members = !symbol.exports ? [] : ts.filter(ts.arrayFrom((symbol.exports).values()), function (p) { return !((p.flags & 4194304 /* Prototype */) || (p.escapedName === "prototype")); });
|
||||
var members = getNamespaceMembersForSerialization(symbol);
|
||||
// Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging)
|
||||
var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
|
||||
var realMembers = locationMap.get("real") || ts.emptyArray;
|
||||
@ -37672,17 +37693,20 @@ var ts;
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (ts.length(realMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & 16 /* Function */));
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
||||
}
|
||||
if (ts.length(mergedMembers)) {
|
||||
var localName = getInternalSymbolName(symbol, symbolName);
|
||||
ts.forEach(mergedMembers, includePrivateSymbol);
|
||||
var nsBody = ts.createModuleBlock([ts.createExportDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined, ts.createNamedExports(ts.map(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export=" /* ExportEquals */; }), function (s) {
|
||||
var name = ts.unescapeLeadingUnderscores(s.escapedName);
|
||||
var localName = getInternalSymbolName(s, name);
|
||||
return ts.createExportSpecifier(name === localName ? undefined : localName, name);
|
||||
var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
includePrivateSymbol(target || s);
|
||||
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
||||
return ts.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
||||
})))]);
|
||||
addResult(ts.createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
@ -37913,6 +37937,7 @@ var ts;
|
||||
serializeMaybeAliasAssignment(symbol);
|
||||
break;
|
||||
case 208 /* BinaryExpression */:
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
@ -37923,10 +37948,6 @@ var ts;
|
||||
serializeExportSpecifier(localName, targetName);
|
||||
}
|
||||
break;
|
||||
case 193 /* PropertyAccessExpression */:
|
||||
// A PAE alias is _always_ going to exist as an append to a top-level export, where our top level
|
||||
// handling should always be sufficient to encode the export action itself
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
|
||||
}
|
||||
@ -37950,7 +37971,8 @@ var ts;
|
||||
var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
|
||||
// serialize what the alias points to, preserve the declaration's initializer
|
||||
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
|
||||
if (target) {
|
||||
// If the target resolves and resolves to a thing defined in this file, emit as an alias, otherwise emit as a const
|
||||
if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
|
||||
// In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it
|
||||
// eg, `namespace A { export class B {} }; exports = A.B;`
|
||||
// Technically, this is all that's required in the case where the assignment is an entity name expression
|
||||
@ -38025,6 +38047,7 @@ var ts;
|
||||
return ts.getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 0 /* String */) &&
|
||||
!getIndexInfoOfType(typeToSerialize, 1 /* Number */) &&
|
||||
!!(ts.length(getPropertiesOfType(typeToSerialize)) || ts.length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) &&
|
||||
!ts.length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
||||
!getDeclarationWithTypeAnnotation(hostSymbol) &&
|
||||
!(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
|
||||
@ -38298,11 +38321,8 @@ var ts;
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
}
|
||||
if (input === "default" /* Default */) {
|
||||
input = "_default";
|
||||
}
|
||||
else if (input === "export=" /* ExportEquals */) {
|
||||
input = "_exports";
|
||||
if (symbol) {
|
||||
input = getNameCandidateWorker(symbol, input);
|
||||
}
|
||||
var i = 0;
|
||||
var original = input;
|
||||
@ -38316,17 +38336,28 @@ var ts;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
function getNameCandidateWorker(symbol, localName) {
|
||||
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
||||
var flags = context.flags;
|
||||
context.flags |= 16777216 /* InInitialEntityName */;
|
||||
var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
||||
context.flags = flags;
|
||||
localName = ts.isIdentifierText(nameCandidate, languageVersion) && !ts.isStringANonContextualKeyword(nameCandidate) ? nameCandidate : getUnusedName("_default", symbol);
|
||||
localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
|
||||
}
|
||||
if (localName === "default" /* Default */) {
|
||||
localName = "_default";
|
||||
}
|
||||
else if (localName === "export=" /* ExportEquals */) {
|
||||
localName = "_exports";
|
||||
}
|
||||
localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
|
||||
return localName;
|
||||
}
|
||||
function getInternalSymbolName(symbol, localName) {
|
||||
if (context.remappedSymbolNames.has("" + getSymbolId(symbol))) {
|
||||
return context.remappedSymbolNames.get("" + getSymbolId(symbol));
|
||||
}
|
||||
localName = getNameCandidateWorker(symbol, localName);
|
||||
// The result of this is going to be used as the symbol's name - lock it in, so `getUnusedName` will also pick it up
|
||||
context.remappedSymbolNames.set("" + getSymbolId(symbol), localName);
|
||||
return localName;
|
||||
@ -38655,6 +38686,8 @@ var ts;
|
||||
return !!target.immediateBaseConstraint;
|
||||
case 6 /* JSDocTypeReference */:
|
||||
return !!getSymbolLinks(target).resolvedJSDocType;
|
||||
case 7 /* ResolvedTypeArguments */:
|
||||
return !!target.resolvedTypeArguments;
|
||||
}
|
||||
return ts.Debug.assertNever(propertyName);
|
||||
}
|
||||
@ -42461,13 +42494,25 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function getTypeArguments(type) {
|
||||
var _a, _b;
|
||||
if (!type.resolvedTypeArguments) {
|
||||
if (!pushTypeResolution(type, 7 /* ResolvedTypeArguments */)) {
|
||||
return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
|
||||
}
|
||||
var node = type.node;
|
||||
var typeArguments = !node ? ts.emptyArray :
|
||||
node.kind === 168 /* TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
|
||||
node.kind === 173 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] :
|
||||
ts.map(node.elementTypes, getTypeFromTypeNode);
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
if (popTypeResolution()) {
|
||||
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
||||
}
|
||||
else {
|
||||
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
|
||||
error(type.node || currentNode, type.target.symbol
|
||||
? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves
|
||||
: ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
|
||||
}
|
||||
}
|
||||
return type.resolvedTypeArguments;
|
||||
}
|
||||
@ -42606,14 +42651,17 @@ var ts;
|
||||
var typeType = valueType;
|
||||
if (symbol.valueDeclaration) {
|
||||
var decl = ts.getRootDeclaration(symbol.valueDeclaration);
|
||||
var isRequireAlias = ts.isVariableDeclaration(decl)
|
||||
&& decl.initializer
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isRequireAlias = false;
|
||||
if (ts.isVariableDeclaration(decl) && decl.initializer) {
|
||||
var expr = decl.initializer;
|
||||
// skip past entity names, eg `require("x").a.b.c`
|
||||
while (ts.isPropertyAccessExpression(expr)) {
|
||||
expr = expr.expression;
|
||||
}
|
||||
isRequireAlias = ts.isCallExpression(expr) && ts.isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
if (isRequireAlias || node.kind === 187 /* ImportType */ || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@ -45736,7 +45784,7 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
||||
var related = relation.get(getRelationKey(source, target, relation));
|
||||
var related = relation.get(getRelationKey(source, target, /*isIntersectionConstituent*/ false, relation));
|
||||
if (related !== undefined) {
|
||||
return !!(related & 1 /* Succeeded */);
|
||||
}
|
||||
@ -46107,7 +46155,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@ -46145,7 +46193,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@ -46429,14 +46477,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@ -46524,7 +46572,7 @@ var ts;
|
||||
if (overflow) {
|
||||
return 0 /* False */;
|
||||
}
|
||||
var id = getRelationKey(source, target, relation);
|
||||
var id = getRelationKey(source, target, isIntersectionConstituent, relation);
|
||||
var entry = relation.get(id);
|
||||
if (entry !== undefined) {
|
||||
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
||||
@ -47710,17 +47758,18 @@ var ts;
|
||||
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
||||
* For other cases, the types ids are used.
|
||||
*/
|
||||
function getRelationKey(source, target, relation) {
|
||||
function getRelationKey(source, target, isIntersectionConstituent, relation) {
|
||||
if (relation === identityRelation && source.id > target.id) {
|
||||
var temp = source;
|
||||
source = target;
|
||||
target = temp;
|
||||
}
|
||||
var intersection = isIntersectionConstituent ? "&" : "";
|
||||
if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
|
||||
var typeParameters = [];
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters);
|
||||
return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + intersection;
|
||||
}
|
||||
return source.id + "," + target.id;
|
||||
return source.id + "," + target.id + intersection;
|
||||
}
|
||||
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
||||
// value that isn't undefined.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user