declare namespace PubSubJS { interface Base extends CountSubscriptions, ClearAllSubscriptions, GetSubscriptions, Publish, Subscribe, Unsubscribe { name: string; version: string; } type Token = string; type Message = string | symbol; type SubscriptionListener = (message: string, data?: T) => void; interface CountSubscriptions { countSubscriptions(token: Token): number; } interface ClearAllSubscriptions { clearAllSubscriptions(token?: Token): void; } interface GetSubscriptions { getSubscriptions(token: Token): Message[]; } interface Publish { publish(message: M, data?: T): boolean; publishSync(message: M, data?: T): boolean; } interface Subscribe { subscribe(message: M, func: SubscriptionListener): Token; subscribeOnce(message: M, func: SubscriptionListener): Base; } interface Unsubscribe { unsubscribe(tokenOrFunction: Token | SubscriptionListener): Token | boolean; } } declare var PubSub: PubSubJS.Base; declare module "pubsub-js" { export = PubSub; }