Skip to content

Predicate Reference

Overview

PredicateDescription
hasDecoratorMatches if the target has a specified decorator
hasJSDocMatches if the target has a specified JSDoc tag
extendsClassMatches if the class extends a specified base class
implementsInterfaceMatches if the class implements a specified interface
nameEndsWithMatches if the target name ends with a specified suffix
nameMatchesMatches if the target name matches a regex pattern
inClassWithMatches if the method is in a class matching the predicate
andMatches if all predicates match
orMatches if any predicate matches

hasDecorator

Matches if the target has a specified decorator

Parameters:

FieldTypeRequiredDescription
namestring | string[]YesDecorator name(s) to match
fromstringNoPackage the decorator is imported from

hasJSDoc

Matches if the target has a specified JSDoc tag

Parameters:

FieldTypeRequiredDescription
tagstringYesJSDoc tag to match (without @)

extendsClass

Matches if the class extends a specified base class

Parameters:

FieldTypeRequiredDescription
namestringYesBase class name to match

implementsInterface

Matches if the class implements a specified interface

Parameters:

FieldTypeRequiredDescription
namestringYesInterface name to match

nameEndsWith

Matches if the target name ends with a specified suffix

Parameters:

FieldTypeRequiredDescription
suffixstringYesSuffix to match

nameMatches

Matches if the target name matches a regex pattern

Parameters:

FieldTypeRequiredDescription
patternstringYesRegex pattern to match against the name

inClassWith

Matches if the method is in a class matching the predicate

Parameters:

FieldTypeRequiredDescription
(nested)predicateYesPredicate the containing class must satisfy

and

Matches if all predicates match

Parameters:

FieldTypeRequiredDescription
(array)predicate[]Yes (min: 2)All predicates must match

or

Matches if any predicate matches

Parameters:

FieldTypeRequiredDescription
(array)predicate[]Yes (min: 2)Any predicate must match

See Also