import { Node , Role } from "@siteimprove/alfa-aria" ; import { Device } from "@siteimprove/alfa-device" ; import { Element } from "@siteimprove/alfa-dom" ; import { Predicate } from "@siteimprove/alfa-predicate" ; export function hasRole ( device , predicate ? ) ; export function hasRole < N extends Role . Name > ( device , name , ... rest ) ; export function hasRole ( device , nameOrPredicate = ( ) => true , ... names ) { let predicate ; if ( typeof nameOrPredicate === "function" ) { predicate = nameOrPredicate ; } else { predicate = Role . hasName ( nameOrPredicate , ... names ) ; } return ( element ) => Node . from ( element , device ) . role . some ( predicate ) ; }