const buttonInputTypes = [ "button" , "color" , "file" , "image" , "reset" , "submit" , ] ; example returns { boolean } export function isButton ( element ) { if ( element . tagName === "BUTTON" ) return true ; if ( element . tagName === "INPUT" ) { const input = element as HTMLInputElement ; return buttonInputTypes . indexOf ( input . type ) !== - 1 ; } return false ; }