/**
 * Extends interfaces in Vue.js
 */

import _Vue from "vue";
import * as SocketIOClient from "socket.io-client";

type DefaultSocketHandlers<V> = {
  [key: string]: (this: V, ...args: any[]) => any;
};

declare module "vue/types/options" {
  interface ComponentOptions<V extends _Vue> {
    socketswc?: DefaultSocketHandlers<V>;
  }
}

declare module "vue/types/vue" {
  interface Vue {
    $socketwc: {
      client: SocketIOClient.Socket;
      $subscribe: (event: string, fn: Function) => void;
      $unsubscribe: (event: string) => void;
      connected: boolean;
      disconnected: boolean;
    };
  }
}
