File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11563,11 +11563,14 @@ namespace ts {
1156311563 return -1;
1156411564 }
1156511565
11566- function checkTypePredicate(node: TypePredicateNode) {
11566+ function checkTypePredicate(node: TypePredicateNode): void {
1156711567 const parent = getTypePredicateParent(node);
1156811568 if (!parent) {
11569+ // The parent must not be valid.
11570+ error(node.parent, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
1156911571 return;
1157011572 }
11573+
1157111574 const typePredicate = getSignatureFromDeclaration(parent).typePredicate;
1157211575 if (!typePredicate) {
1157311576 return;
Original file line number Diff line number Diff line change 723723 "category" : " Error" ,
724724 "code" : 1227
725725 },
726+ "A type predicate is only allowed in return type position for functions and methods." : {
727+ "category" : " Error" ,
728+ "code" : 1228
729+ },
726730 "A type predicate cannot reference a rest parameter." : {
727731 "category" : " Error" ,
728732 "code" : 1229
You can’t perform that action at this time.
0 commit comments