File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -745,6 +745,10 @@ Assertion functions checking a type
745745function f(x: any): asserts x is number {
746746}
747747
748+ class Foo<T> {
749+ test(): this is T {}
750+ }
751+
748752function isT(t: T): t is T {
749753 return true
750754}
@@ -759,6 +763,18 @@ function isT(t: T): t is T {
759763 (identifier) (type_annotation (predefined_type))))
760764 (asserts (type_predicate (identifier) (predefined_type)))
761765 (statement_block))
766+ (class_declaration
767+ (type_identifier)
768+ (type_parameters (type_parameter (type_identifier)))
769+ (class_body
770+ (method_definition
771+ (property_identifier)
772+ (formal_parameters)
773+ (type_predicate_annotation
774+ (type_predicate
775+ (this)
776+ (type_identifier)))
777+ (statement_block))))
762778 (function_declaration
763779 (identifier)
764780 (formal_parameters
Original file line number Diff line number Diff line change @@ -580,7 +580,7 @@ module.exports = function defineGrammar(dialect) {
580580 ) ,
581581
582582 type_predicate : $ => seq (
583- $ . identifier ,
583+ choice ( $ . identifier , $ . this ) ,
584584 'is' ,
585585 $ . _type
586586 ) ,
You can’t perform that action at this time.
0 commit comments