Merge pull request #16734 from HerringtonDarkholme/error

fix #16702: polish type predicate error message
This commit is contained in:
Nathan Shively-Sanders
2017-06-28 12:33:45 -07:00
committed by GitHub
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -8524,7 +8524,7 @@ namespace ts {
}
else if (isIdentifierTypePredicate(target.typePredicate)) {
if (reportErrors) {
errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
}
return Ternary.False;
}
+2 -2
View File
@@ -707,7 +707,7 @@
"category": "Error",
"code": 1223
},
"Signature '{0}' must have a type predicate.": {
"Signature '{0}' must be a type predicate.": {
"category": "Error",
"code": 1224
},
@@ -3637,7 +3637,7 @@
"category": "Message",
"code": 90025
},
"Convert function to an ES2015 class": {
"category": "Message",
"code": 95001
@@ -27,7 +27,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(74,46)
Type 'C' is not assignable to type 'B'.
Property 'propB' is missing in type 'C'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(78,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'.
Signature '(p1: any, p2: any): boolean' must have a type predicate.
Signature '(p1: any, p2: any): boolean' must be a type predicate.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(84,1): error TS2322: Type '(p1: any, p2: any) => p2 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'.
Type predicate 'p2 is A' is not assignable to 'p1 is A'.
Parameter 'p2' is not in the same position as parameter 'p1'.
@@ -194,7 +194,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(136,39
assign1 = function(p1, p2): boolean {
~~~~~~~
!!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'.
!!! error TS2322: Signature '(p1: any, p2: any): boolean' must have a type predicate.
!!! error TS2322: Signature '(p1: any, p2: any): boolean' must be a type predicate.
return true;
};