mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG.
This commit is contained in:
@@ -1209,6 +1209,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Another_export_default_is_here_2753" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Another export default is here.]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Argument_expression_expected_1135" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Argument expression expected.]]></Val>
|
||||
@@ -5679,6 +5685,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";The_first_export_default_is_here_2752" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The first export default is here.]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The first parameter of the 'then' method of a promise must be a callback.]]></Val>
|
||||
|
||||
+160
-77
@@ -3752,6 +3752,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -13025,6 +13027,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -22510,24 +22525,34 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
if (symbol.declarations && symbol.declarations.length &&
|
||||
(node.kind === 254 && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0, name);
|
||||
}
|
||||
}
|
||||
@@ -25957,18 +25982,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -26140,7 +26153,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -26544,7 +26557,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26758,7 +26771,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26905,7 +26918,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -30185,7 +30198,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -31015,13 +31028,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0]));
|
||||
}
|
||||
}
|
||||
@@ -31033,15 +31055,16 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -31493,7 +31516,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33460,12 +33483,15 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -34590,7 +34616,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -34623,7 +34649,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, undefined, undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -34661,13 +34687,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35186,7 +35212,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -39308,7 +39334,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39832,7 +39858,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -41130,7 +41164,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -41215,7 +41249,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -41838,25 +41872,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -42235,12 +42285,11 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 | 2)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -42250,6 +42299,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -42291,7 +42341,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -42302,7 +42352,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -45133,7 +45183,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -49324,8 +49374,8 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -49715,10 +49765,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -65961,12 +66011,24 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, false, true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, false, true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -66743,7 +66805,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92))
|
||||
if (!ts.hasModifier(param, 92) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72) {
|
||||
@@ -72202,11 +72264,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, false, false, undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), false, false, undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts") && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), false, false, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72244,8 +72313,8 @@ var ts;
|
||||
ts.Debug.assert(!!missingFilePaths);
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
||||
@@ -77217,9 +77286,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) :
|
||||
buildSingleProject(resolved);
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) :
|
||||
updateBundle(resolved);
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -77441,7 +77510,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -77556,9 +77630,9 @@ var ts;
|
||||
reportAndStoreErrors(next, errors);
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) :
|
||||
buildSingleProject(next);
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) :
|
||||
updateBundle(next);
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -77571,6 +77645,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
|
||||
+166
-78
@@ -5807,6 +5807,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -16270,6 +16272,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -27719,13 +27734,15 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
// If the current node is a default export of some sort, then check if
|
||||
// there are any other default exports that we need to error on.
|
||||
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
|
||||
@@ -27736,14 +27753,22 @@ var ts;
|
||||
(node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0 /* None */, name);
|
||||
}
|
||||
}
|
||||
@@ -31778,18 +31803,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -31969,7 +31982,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -32494,7 +32507,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32732,7 +32745,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32916,7 +32929,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -36551,7 +36564,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -37539,13 +37552,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1 /* Construct */).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(/*searchElement*/ true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0]));
|
||||
}
|
||||
}
|
||||
@@ -37559,7 +37581,8 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
// When an intersection type contains mixin constructor types, the construct signatures from
|
||||
@@ -37567,12 +37590,12 @@ var ts;
|
||||
// other construct signatures in the intersection type. For example, the intersection type
|
||||
// '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature
|
||||
// 'new(s: string) => A & B'.
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1 /* Construct */);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -38098,7 +38121,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40295,12 +40318,15 @@ var ts;
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -41565,7 +41591,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41600,7 +41626,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -41647,13 +41673,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42219,7 +42245,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -46997,7 +47023,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47649,7 +47675,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016 /* StructuredType */) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016 /* StructuredType */) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -49222,7 +49256,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -49311,7 +49345,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -50062,25 +50096,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -50593,13 +50643,12 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152 /* Intersection */) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
// We want to ignore mixin ctors
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 /* Class */ | 2 /* Interface */)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -50609,6 +50658,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50652,7 +50702,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 /* Call */ ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -50665,7 +50715,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -53895,7 +53945,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58869,8 +58919,8 @@ var ts;
|
||||
else {
|
||||
// Otherwise issue top-level error since the files appear very identical in terms of what they contain
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -59266,10 +59316,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81251,12 +81301,28 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(
|
||||
// to handle
|
||||
// ... parameters, /* @internal */
|
||||
// public param: string
|
||||
ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, /* stopAfterLineBreak */ false, /* stopAtComments */ true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, /* stopAfterLineBreak */ false, /* stopAtComments */ true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -82113,7 +82179,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */))
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72 /* Identifier */) {
|
||||
@@ -88170,11 +88236,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88222,8 +88295,8 @@ var ts;
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
// old file wasnt redirect but new file is
|
||||
@@ -93992,9 +94065,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(resolved); // Actual build
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) : // Actual build
|
||||
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -94237,7 +94310,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -94361,9 +94439,9 @@ var ts;
|
||||
// Do nothing
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(next); // Actual build
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) : // Actual build
|
||||
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -94376,6 +94454,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
@@ -124147,7 +124234,8 @@ var ts;
|
||||
server.isScriptInfo = isScriptInfo;
|
||||
var Project = /** @class */ (function () {
|
||||
/*@internal*/
|
||||
function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
function Project(
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
var _this = this;
|
||||
this.projectName = projectName;
|
||||
this.projectKind = projectKind;
|
||||
|
||||
+166
-78
@@ -5806,6 +5806,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -16269,6 +16271,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -27718,13 +27733,15 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
// If the current node is a default export of some sort, then check if
|
||||
// there are any other default exports that we need to error on.
|
||||
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
|
||||
@@ -27735,14 +27752,22 @@ var ts;
|
||||
(node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0 /* None */, name);
|
||||
}
|
||||
}
|
||||
@@ -31777,18 +31802,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -31968,7 +31981,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -32493,7 +32506,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32731,7 +32744,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32915,7 +32928,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -36550,7 +36563,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -37538,13 +37551,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1 /* Construct */).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(/*searchElement*/ true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0]));
|
||||
}
|
||||
}
|
||||
@@ -37558,7 +37580,8 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
// When an intersection type contains mixin constructor types, the construct signatures from
|
||||
@@ -37566,12 +37589,12 @@ var ts;
|
||||
// other construct signatures in the intersection type. For example, the intersection type
|
||||
// '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature
|
||||
// 'new(s: string) => A & B'.
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1 /* Construct */);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -38097,7 +38120,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40294,12 +40317,15 @@ var ts;
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -41564,7 +41590,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41599,7 +41625,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -41646,13 +41672,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42218,7 +42244,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -46996,7 +47022,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47648,7 +47674,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016 /* StructuredType */) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016 /* StructuredType */) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -49221,7 +49255,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -49310,7 +49344,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -50061,25 +50095,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -50592,13 +50642,12 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152 /* Intersection */) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
// We want to ignore mixin ctors
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 /* Class */ | 2 /* Interface */)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -50608,6 +50657,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50651,7 +50701,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 /* Call */ ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -50664,7 +50714,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -53894,7 +53944,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58868,8 +58918,8 @@ var ts;
|
||||
else {
|
||||
// Otherwise issue top-level error since the files appear very identical in terms of what they contain
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -59265,10 +59315,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81250,12 +81300,28 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(
|
||||
// to handle
|
||||
// ... parameters, /* @internal */
|
||||
// public param: string
|
||||
ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, /* stopAfterLineBreak */ false, /* stopAtComments */ true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, /* stopAfterLineBreak */ false, /* stopAtComments */ true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -82112,7 +82178,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */))
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72 /* Identifier */) {
|
||||
@@ -88169,11 +88235,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88221,8 +88294,8 @@ var ts;
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
// old file wasnt redirect but new file is
|
||||
@@ -93991,9 +94064,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(resolved); // Actual build
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) : // Actual build
|
||||
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -94236,7 +94309,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -94360,9 +94438,9 @@ var ts;
|
||||
// Do nothing
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(next); // Actual build
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) : // Actual build
|
||||
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -94375,6 +94453,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
@@ -124146,7 +124233,8 @@ var ts;
|
||||
server.isScriptInfo = isScriptInfo;
|
||||
var Project = /** @class */ (function () {
|
||||
/*@internal*/
|
||||
function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
function Project(
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
var _this = this;
|
||||
this.projectName = projectName;
|
||||
this.projectKind = projectKind;
|
||||
|
||||
+164
-77
@@ -5797,6 +5797,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -16260,6 +16262,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -27709,13 +27724,15 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
// If the current node is a default export of some sort, then check if
|
||||
// there are any other default exports that we need to error on.
|
||||
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
|
||||
@@ -27726,14 +27743,22 @@ var ts;
|
||||
(node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0 /* None */, name);
|
||||
}
|
||||
}
|
||||
@@ -31768,18 +31793,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -31959,7 +31972,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -32484,7 +32497,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32722,7 +32735,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32906,7 +32919,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -36541,7 +36554,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -37529,13 +37542,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1 /* Construct */).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(/*searchElement*/ true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0]));
|
||||
}
|
||||
}
|
||||
@@ -37549,7 +37571,8 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
// When an intersection type contains mixin constructor types, the construct signatures from
|
||||
@@ -37557,12 +37580,12 @@ var ts;
|
||||
// other construct signatures in the intersection type. For example, the intersection type
|
||||
// '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature
|
||||
// 'new(s: string) => A & B'.
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1 /* Construct */);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -38088,7 +38111,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40285,12 +40308,15 @@ var ts;
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -41555,7 +41581,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41590,7 +41616,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -41637,13 +41663,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42209,7 +42235,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -46987,7 +47013,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47639,7 +47665,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016 /* StructuredType */) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016 /* StructuredType */) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -49212,7 +49246,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -49301,7 +49335,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -50052,25 +50086,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -50583,13 +50633,12 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152 /* Intersection */) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
// We want to ignore mixin ctors
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 /* Class */ | 2 /* Interface */)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -50599,6 +50648,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50642,7 +50692,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 /* Call */ ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -50655,7 +50705,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -53885,7 +53935,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58859,8 +58909,8 @@ var ts;
|
||||
else {
|
||||
// Otherwise issue top-level error since the files appear very identical in terms of what they contain
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -59256,10 +59306,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81241,12 +81291,28 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(
|
||||
// to handle
|
||||
// ... parameters, /* @internal */
|
||||
// public param: string
|
||||
ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, /* stopAfterLineBreak */ false, /* stopAtComments */ true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, /* stopAfterLineBreak */ false, /* stopAtComments */ true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -82103,7 +82169,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */))
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72 /* Identifier */) {
|
||||
@@ -88160,11 +88226,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88212,8 +88285,8 @@ var ts;
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
// old file wasnt redirect but new file is
|
||||
@@ -93982,9 +94055,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(resolved); // Actual build
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) : // Actual build
|
||||
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -94227,7 +94300,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -94351,9 +94429,9 @@ var ts;
|
||||
// Do nothing
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(next); // Actual build
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) : // Actual build
|
||||
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -94366,6 +94444,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
|
||||
+164
-77
@@ -5797,6 +5797,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -16260,6 +16262,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -27709,13 +27724,15 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
// If the current node is a default export of some sort, then check if
|
||||
// there are any other default exports that we need to error on.
|
||||
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
|
||||
@@ -27726,14 +27743,22 @@ var ts;
|
||||
(node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0 /* None */, name);
|
||||
}
|
||||
}
|
||||
@@ -31768,18 +31793,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -31959,7 +31972,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -32484,7 +32497,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32722,7 +32735,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32906,7 +32919,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -36541,7 +36554,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -37529,13 +37542,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1 /* Construct */).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(/*searchElement*/ true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0]));
|
||||
}
|
||||
}
|
||||
@@ -37549,7 +37571,8 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
// When an intersection type contains mixin constructor types, the construct signatures from
|
||||
@@ -37557,12 +37580,12 @@ var ts;
|
||||
// other construct signatures in the intersection type. For example, the intersection type
|
||||
// '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature
|
||||
// 'new(s: string) => A & B'.
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1 /* Construct */);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -38088,7 +38111,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40285,12 +40308,15 @@ var ts;
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -41555,7 +41581,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41590,7 +41616,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -41637,13 +41663,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42209,7 +42235,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -46987,7 +47013,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47639,7 +47665,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016 /* StructuredType */) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016 /* StructuredType */) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -49212,7 +49246,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -49301,7 +49335,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -50052,25 +50086,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -50583,13 +50633,12 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152 /* Intersection */) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
// We want to ignore mixin ctors
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 /* Class */ | 2 /* Interface */)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -50599,6 +50648,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50642,7 +50692,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 /* Call */ ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -50655,7 +50705,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -53885,7 +53935,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58859,8 +58909,8 @@ var ts;
|
||||
else {
|
||||
// Otherwise issue top-level error since the files appear very identical in terms of what they contain
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -59256,10 +59306,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81241,12 +81291,28 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(
|
||||
// to handle
|
||||
// ... parameters, /* @internal */
|
||||
// public param: string
|
||||
ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, /* stopAfterLineBreak */ false, /* stopAtComments */ true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, /* stopAfterLineBreak */ false, /* stopAtComments */ true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -82103,7 +82169,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */))
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72 /* Identifier */) {
|
||||
@@ -88160,11 +88226,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88212,8 +88285,8 @@ var ts;
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
// old file wasnt redirect but new file is
|
||||
@@ -93982,9 +94055,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(resolved); // Actual build
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) : // Actual build
|
||||
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -94227,7 +94300,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -94351,9 +94429,9 @@ var ts;
|
||||
// Do nothing
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(next); // Actual build
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) : // Actual build
|
||||
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -94366,6 +94444,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
|
||||
+164
-77
@@ -5798,6 +5798,8 @@ var ts;
|
||||
_0_refers_to_a_value_but_is_being_used_as_a_type_here: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_2749", "'{0}' refers to a value, but is being used as a type here."),
|
||||
The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
|
||||
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
|
||||
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
|
||||
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
|
||||
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
||||
@@ -16261,6 +16263,19 @@ var ts;
|
||||
return arr.slice(index);
|
||||
}
|
||||
ts.sliceAfter = sliceAfter;
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
ts.addRelatedInfo = addRelatedInfo;
|
||||
function minAndMax(arr, getValue) {
|
||||
Debug.assert(arr.length !== 0);
|
||||
var min = getValue(arr[0]);
|
||||
@@ -27710,13 +27725,15 @@ var ts;
|
||||
message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
|
||||
messageNeedsName_1 = false;
|
||||
}
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
var multipleDefaultExports_1 = false;
|
||||
if (ts.length(symbol.declarations)) {
|
||||
// If the current node is a default export of some sort, then check if
|
||||
// there are any other default exports that we need to error on.
|
||||
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
|
||||
if (isDefaultExport) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
else {
|
||||
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
|
||||
@@ -27727,14 +27744,22 @@ var ts;
|
||||
(node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
|
||||
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
messageNeedsName_1 = false;
|
||||
multipleDefaultExports_1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var addError = function (decl) {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(decl) || decl, message_1, messageNeedsName_1 ? getDisplayName(decl) : undefined));
|
||||
};
|
||||
ts.forEach(symbol.declarations, addError);
|
||||
addError(node);
|
||||
var declarationName_1 = ts.getNameOfDeclaration(node) || node;
|
||||
var relatedInformation_1 = [];
|
||||
ts.forEach(symbol.declarations, function (declaration, index) {
|
||||
var decl = ts.getNameOfDeclaration(declaration) || declaration;
|
||||
var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
|
||||
if (multipleDefaultExports_1) {
|
||||
relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
|
||||
}
|
||||
});
|
||||
var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
|
||||
file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInformation_1)) : diag);
|
||||
symbol = createSymbol(0 /* None */, name);
|
||||
}
|
||||
}
|
||||
@@ -31769,18 +31794,6 @@ var ts;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
function addRelatedInfo(diagnostic) {
|
||||
var _a;
|
||||
var relatedInformation = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
relatedInformation[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (!diagnostic.relatedInformation) {
|
||||
diagnostic.relatedInformation = [];
|
||||
}
|
||||
(_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
|
||||
return diagnostic;
|
||||
}
|
||||
function error(location, message, arg0, arg1, arg2, arg3) {
|
||||
var diagnostic = location
|
||||
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
|
||||
@@ -31960,7 +31973,7 @@ var ts;
|
||||
err.relatedInformation = err.relatedInformation || [];
|
||||
if (ts.length(err.relatedInformation) >= 5)
|
||||
continue;
|
||||
addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? ts.createDiagnosticForNode(relatedNode, ts.Diagnostics._0_was_also_declared_here, symbolName) : ts.createDiagnosticForNode(relatedNode, ts.Diagnostics.and_here));
|
||||
}
|
||||
}
|
||||
function combineSymbolTables(first, second) {
|
||||
@@ -32485,7 +32498,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32723,7 +32736,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32907,7 +32920,7 @@ var ts;
|
||||
var suggestionName = symbolToString(suggestion);
|
||||
var diagnostic = error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
||||
if (suggestion.valueDeclaration) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -36542,7 +36555,7 @@ var ts;
|
||||
ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
|
||||
}
|
||||
}
|
||||
addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
|
||||
}
|
||||
return type.resolvedBaseConstructorType = errorType;
|
||||
}
|
||||
@@ -37530,13 +37543,22 @@ var ts;
|
||||
function unionSpreadIndexInfos(info1, info2) {
|
||||
return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
|
||||
}
|
||||
function includeMixinType(type, types, index) {
|
||||
function findMixins(types) {
|
||||
var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1 /* Construct */).length > 0; });
|
||||
var mixinFlags = ts.map(types, isMixinConstructorType);
|
||||
if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
|
||||
var firstMixinIndex = mixinFlags.indexOf(/*searchElement*/ true);
|
||||
mixinFlags[firstMixinIndex] = false;
|
||||
}
|
||||
return mixinFlags;
|
||||
}
|
||||
function includeMixinType(type, types, mixinFlags, index) {
|
||||
var mixedTypes = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (i === index) {
|
||||
mixedTypes.push(type);
|
||||
}
|
||||
else if (isMixinConstructorType(types[i])) {
|
||||
else if (mixinFlags[i]) {
|
||||
mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0]));
|
||||
}
|
||||
}
|
||||
@@ -37550,7 +37572,8 @@ var ts;
|
||||
var stringIndexInfo;
|
||||
var numberIndexInfo;
|
||||
var types = type.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
|
||||
var _loop_6 = function (i) {
|
||||
var t = type.types[i];
|
||||
// When an intersection type contains mixin constructor types, the construct signatures from
|
||||
@@ -37558,12 +37581,12 @@ var ts;
|
||||
// other construct signatures in the intersection type. For example, the intersection type
|
||||
// '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature
|
||||
// 'new(s: string) => A & B'.
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) {
|
||||
if (!mixinFlags[i]) {
|
||||
var signatures = getSignaturesOfType(t, 1 /* Construct */);
|
||||
if (signatures.length && mixinCount > 0) {
|
||||
signatures = ts.map(signatures, function (s) {
|
||||
var clone = cloneSignature(s);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i);
|
||||
clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
|
||||
return clone;
|
||||
});
|
||||
}
|
||||
@@ -38089,7 +38112,7 @@ var ts;
|
||||
if (errorNode) {
|
||||
var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
||||
if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40286,12 +40309,15 @@ var ts;
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return type.simplified = mapType(instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper), getSimplifiedType);
|
||||
return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
|
||||
}
|
||||
return type.simplified = type;
|
||||
}
|
||||
function substituteIndexedMappedType(objectType, index) {
|
||||
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
||||
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
||||
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
|
||||
if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
|
||||
if (objectType === wildcardType || indexType === wildcardType) {
|
||||
@@ -41556,7 +41582,7 @@ var ts;
|
||||
var resultObj = {};
|
||||
checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj);
|
||||
var diagnostic = resultObj.error;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41591,7 +41617,7 @@ var ts;
|
||||
checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj);
|
||||
if (resultObj.error) {
|
||||
if (target.symbol && ts.length(target.symbol.declarations)) {
|
||||
addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
ts.addRelatedInfo(resultObj.error, ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -41638,13 +41664,13 @@ var ts;
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
|
||||
var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
||||
if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
||||
addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42210,7 +42236,7 @@ var ts;
|
||||
}
|
||||
var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
ts.addRelatedInfo.apply(void 0, [diag].concat(relatedInfo));
|
||||
}
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
@@ -46988,7 +47014,7 @@ var ts;
|
||||
if (!ts.isSourceFile(container)) {
|
||||
var outsideThis = tryGetThisTypeAt(container);
|
||||
if (outsideThis && outsideThis !== globalThisType_1) {
|
||||
addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47640,7 +47666,15 @@ var ts;
|
||||
}
|
||||
function getTypeOfPropertyOfContextualType(type, name) {
|
||||
return mapType(type, function (t) {
|
||||
if (t.flags & 3670016 /* StructuredType */) {
|
||||
if (isGenericMappedType(t)) {
|
||||
var constraint = getConstraintTypeFromMappedType(t);
|
||||
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
||||
var propertyNameType = getLiteralType(ts.unescapeLeadingUnderscores(name));
|
||||
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
||||
return substituteIndexedMappedType(t, propertyNameType);
|
||||
}
|
||||
}
|
||||
else if (t.flags & 3670016 /* StructuredType */) {
|
||||
var prop = getPropertyOfType(t, name);
|
||||
if (prop) {
|
||||
return getTypeOfSymbol(prop);
|
||||
@@ -49213,7 +49247,7 @@ var ts;
|
||||
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
|
||||
}
|
||||
}
|
||||
function isInPropertyInitializer(node) {
|
||||
@@ -49302,7 +49336,7 @@ var ts;
|
||||
}
|
||||
var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
|
||||
if (relatedInfo) {
|
||||
addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
||||
}
|
||||
diagnostics.add(resultDiagnostic);
|
||||
}
|
||||
@@ -50053,25 +50087,41 @@ var ts;
|
||||
if (argCount <= max && hasSpreadArgument) {
|
||||
argCount--;
|
||||
}
|
||||
var spanArray;
|
||||
var related;
|
||||
var error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1;
|
||||
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
|
||||
var paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
|
||||
if (paramDecl) {
|
||||
related = ts.createDiagnosticForNode(paramDecl, ts.isBindingPattern(paramDecl.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts.Diagnostics.An_argument_for_0_was_not_provided, !paramDecl.name ? argCount : !ts.isBindingPattern(paramDecl.name) ? ts.idText(getFirstIdentifier(paramDecl.name)) : undefined);
|
||||
}
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
var error_1 = hasRestParameter && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
|
||||
hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 :
|
||||
ts.Diagnostics.Expected_0_arguments_but_got_1_or_more;
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (min < argCount && argCount < max) {
|
||||
return ts.createDiagnosticForNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNode(node, ts.Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
|
||||
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
if (!hasSpreadArgument && argCount < min) {
|
||||
var diagnostic_1 = ts.createDiagnosticForNode(node, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic_1, related) : diagnostic_1;
|
||||
}
|
||||
if (hasRestParameter || hasSpreadArgument) {
|
||||
spanArray = ts.createNodeArray(args);
|
||||
if (hasSpreadArgument && argCount) {
|
||||
var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
|
||||
spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanArray = ts.createNodeArray(args.slice(max));
|
||||
}
|
||||
spanArray.pos = ts.first(spanArray).pos;
|
||||
spanArray.end = ts.last(spanArray).end;
|
||||
if (spanArray.end === spanArray.pos) {
|
||||
spanArray.end++;
|
||||
}
|
||||
var diagnostic = ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
|
||||
return related ? ts.addRelatedInfo(diagnostic, related) : diagnostic;
|
||||
}
|
||||
function getTypeArgumentArityError(node, signatures, typeArguments) {
|
||||
var argCount = typeArguments.length;
|
||||
@@ -50584,13 +50634,12 @@ var ts;
|
||||
var firstBase = baseTypes[0];
|
||||
if (firstBase.flags & 2097152 /* Intersection */) {
|
||||
var types = firstBase.types;
|
||||
var mixinCount = ts.countWhere(types, isMixinConstructorType);
|
||||
var mixinFlags = findMixins(types);
|
||||
var i = 0;
|
||||
for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
|
||||
var intersectionMember = _a[_i];
|
||||
i++;
|
||||
// We want to ignore mixin ctors
|
||||
if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(intersectionMember)) {
|
||||
if (!mixinFlags[i]) {
|
||||
if (ts.getObjectFlags(intersectionMember) & (1 /* Class */ | 2 /* Interface */)) {
|
||||
if (intersectionMember.symbol === target) {
|
||||
return true;
|
||||
@@ -50600,6 +50649,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50643,7 +50693,7 @@ var ts;
|
||||
var diagnostic = error(node, (kind === 0 /* Call */ ?
|
||||
ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures :
|
||||
ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature), typeToString(apparentType));
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
|
||||
}
|
||||
function invocationErrorRecovery(apparentType, kind, diagnostic) {
|
||||
if (!apparentType.symbol) {
|
||||
@@ -50656,7 +50706,7 @@ var ts;
|
||||
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
||||
if (!sigs || !sigs.length)
|
||||
return;
|
||||
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
||||
}
|
||||
}
|
||||
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
||||
@@ -53886,7 +53936,7 @@ var ts;
|
||||
for (var _a = 0, signatures_6 = signatures; _a < signatures_6.length; _a++) {
|
||||
var signature = signatures_6[_a];
|
||||
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
||||
addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58860,8 +58910,8 @@ var ts;
|
||||
else {
|
||||
// Otherwise issue top-level error since the files appear very identical in terms of what they contain
|
||||
var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
|
||||
}
|
||||
});
|
||||
amalgamatedDuplicates = undefined;
|
||||
@@ -59257,10 +59307,10 @@ var ts;
|
||||
var nonSimpleParameters = getNonSimpleParameters(node.parameters);
|
||||
if (ts.length(nonSimpleParameters)) {
|
||||
ts.forEach(nonSimpleParameters, function (parameter) {
|
||||
addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
|
||||
});
|
||||
var diagnostics_1 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
|
||||
addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
ts.addRelatedInfo.apply(void 0, [error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)].concat(diagnostics_1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81242,12 +81292,28 @@ var ts;
|
||||
return result.diagnostics;
|
||||
}
|
||||
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
|
||||
function hasInternalAnnotation(range, currentSourceFile) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
}
|
||||
function isInternalDeclaration(node, currentSourceFile) {
|
||||
var parseTreeNode = ts.getParseTreeNode(node);
|
||||
if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
|
||||
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
||||
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
|
||||
var text = currentSourceFile.text;
|
||||
var commentRanges = previousSibling
|
||||
? ts.concatenate(
|
||||
// to handle
|
||||
// ... parameters, /* @internal */
|
||||
// public param: string
|
||||
ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, /* stopAfterLineBreak */ false, /* stopAtComments */ true)), ts.getLeadingCommentRanges(text, node.pos))
|
||||
: ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, /* stopAfterLineBreak */ false, /* stopAtComments */ true));
|
||||
return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
|
||||
}
|
||||
var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
||||
return !!ts.forEach(leadingCommentRanges, function (range) {
|
||||
var comment = currentSourceFile.text.substring(range.pos, range.end);
|
||||
return ts.stringContains(comment, "@internal");
|
||||
return hasInternalAnnotation(range, currentSourceFile);
|
||||
});
|
||||
}
|
||||
ts.isInternalDeclaration = isInternalDeclaration;
|
||||
@@ -82104,7 +82170,7 @@ var ts;
|
||||
if (ctor) {
|
||||
var oldDiag_1 = getSymbolAccessibilityDiagnostic;
|
||||
parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */))
|
||||
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
||||
return;
|
||||
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
|
||||
if (param.name.kind === 72 /* Identifier */) {
|
||||
@@ -88161,11 +88227,18 @@ var ts;
|
||||
if (rootNames.length) {
|
||||
for (var _i = 0, resolvedProjectReferences_1 = resolvedProjectReferences; _i < resolvedProjectReferences_1.length; _i++) {
|
||||
var parsedRef = resolvedProjectReferences_1[_i];
|
||||
if (parsedRef) {
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
var dtsOutfile = ts.changeExtension(out, ".d.ts");
|
||||
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
if (!parsedRef)
|
||||
continue;
|
||||
var out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
|
||||
if (out) {
|
||||
processSourceFile(ts.changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88213,8 +88286,8 @@ var ts;
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
var oldSourceFiles = oldProgram.getSourceFiles();
|
||||
for (var _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_a];
|
||||
for (var _c = 0, oldSourceFiles_1 = oldSourceFiles; _c < oldSourceFiles_1.length; _c++) {
|
||||
var oldSourceFile = oldSourceFiles_1[_c];
|
||||
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
||||
if (shouldCreateNewSourceFile || !newFile ||
|
||||
// old file wasnt redirect but new file is
|
||||
@@ -93983,9 +94056,9 @@ var ts;
|
||||
updateOutputTimestamps(proj);
|
||||
return;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
|
||||
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(resolved); // Actual build
|
||||
var buildResult = needsBuild(status, resolved) ?
|
||||
buildSingleProject(resolved) : // Actual build
|
||||
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
|
||||
if (buildResult & BuildResultFlags.AnyErrors)
|
||||
return;
|
||||
var _a = getGlobalDependencyGraph(), referencingProjectsMap = _a.referencingProjectsMap, buildQueue = _a.buildQueue;
|
||||
@@ -94228,7 +94301,12 @@ var ts;
|
||||
return reportStatus(ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
|
||||
}
|
||||
var priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime });
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
@@ -94352,9 +94430,9 @@ var ts;
|
||||
// Do nothing
|
||||
continue;
|
||||
}
|
||||
var buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
|
||||
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
|
||||
buildSingleProject(next); // Actual build
|
||||
var buildResult = needsBuild(status, next) ?
|
||||
buildSingleProject(next) : // Actual build
|
||||
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
|
||||
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
|
||||
}
|
||||
reportErrorSummary();
|
||||
@@ -94367,6 +94445,15 @@ var ts;
|
||||
readFileWithCache = savedReadFileWithCache;
|
||||
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
|
||||
}
|
||||
function needsBuild(status, configFile) {
|
||||
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force)
|
||||
return true;
|
||||
var config = parseConfigFile(configFile);
|
||||
return !config ||
|
||||
config.fileNames.length === 0 ||
|
||||
!!config.errors.length ||
|
||||
!ts.isIncrementalCompilation(config.options);
|
||||
}
|
||||
function reportParseConfigFileDiagnostic(proj) {
|
||||
reportAndStoreErrors(proj, [configFileCache.getValue(proj)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user