Skip to content

Commit cf0fe92

Browse files
authored
Merge pull request #16734 from HerringtonDarkholme/error
fix #16702: polish type predicate error message
2 parents faf2e2a + 962aee9 commit cf0fe92

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8524,7 +8524,7 @@ namespace ts {
85248524
}
85258525
else if (isIdentifierTypePredicate(target.typePredicate)) {
85268526
if (reportErrors) {
8527-
errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
8527+
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
85288528
}
85298529
return Ternary.False;
85308530
}

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@
707707
"category": "Error",
708708
"code": 1223
709709
},
710-
"Signature '{0}' must have a type predicate.": {
710+
"Signature '{0}' must be a type predicate.": {
711711
"category": "Error",
712712
"code": 1224
713713
},
@@ -3637,7 +3637,7 @@
36373637
"category": "Message",
36383638
"code": 90025
36393639
},
3640-
3640+
36413641
"Convert function to an ES2015 class": {
36423642
"category": "Message",
36433643
"code": 95001

tests/baselines/reference/typeGuardFunctionErrors.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(74,46)
2727
Type 'C' is not assignable to type 'B'.
2828
Property 'propB' is missing in type 'C'.
2929
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'.
30-
Signature '(p1: any, p2: any): boolean' must have a type predicate.
30+
Signature '(p1: any, p2: any): boolean' must be a type predicate.
3131
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'.
3232
Type predicate 'p2 is A' is not assignable to 'p1 is A'.
3333
Parameter 'p2' is not in the same position as parameter 'p1'.
@@ -194,7 +194,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(136,39
194194
assign1 = function(p1, p2): boolean {
195195
~~~~~~~
196196
!!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'.
197-
!!! error TS2322: Signature '(p1: any, p2: any): boolean' must have a type predicate.
197+
!!! error TS2322: Signature '(p1: any, p2: any): boolean' must be a type predicate.
198198
return true;
199199
};
200200

0 commit comments

Comments
 (0)