Skip to content

Commit 962aee9

Browse files
fix #16702: polish type predicate error message
1 parent fd22a88 commit 962aee9

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
@@ -8517,7 +8517,7 @@ namespace ts {
85178517
}
85188518
else if (isIdentifierTypePredicate(target.typePredicate)) {
85198519
if (reportErrors) {
8520-
errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
8520+
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
85218521
}
85228522
return Ternary.False;
85238523
}

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)