Updated error message.

This commit is contained in:
Daniel Rosenwasser
2015-11-03 17:17:53 -08:00
parent ab7c4e5e43
commit e224083038
2 changed files with 13 additions and 6 deletions
+9 -2
View File
@@ -4832,7 +4832,14 @@ namespace ts {
sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType);
targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType);
}
reportError(message || Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType);
if (!message) {
message = relation === comparableRelation ?
Diagnostics.Type_0_is_not_comparable_with_type_1 :
Diagnostics.Type_0_is_not_assignable_to_type_1
}
reportError(message, sourceType, targetType);
}
// Compare two types and return
@@ -9411,7 +9418,7 @@ namespace ts {
let widenedType = getWidenedType(exprType);
if (!isTypeComparableTo(targetType, widenedType)) {
checkTypeComparableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other);
checkTypeComparableTo(exprType, targetType, node);
}
}
return targetType;
+4 -4
View File
@@ -888,6 +888,10 @@
"category": "Error",
"code": 2322
},
"Type '{0}' is not comparable with type '{1}'.": {
"category": "Error",
"code": 2323
},
"Property '{0}' is missing in type '{1}'.": {
"category": "Error",
"code": 2324
@@ -996,10 +1000,6 @@
"category": "Error",
"code": 2351
},
"Neither type '{0}' nor type '{1}' is assignable to the other.": {
"category": "Error",
"code": 2352
},
"Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.": {
"category": "Error",
"code": 2353