More general type for addEventListener