@types/feathersjs__socket-commons
TypeScript icon, indicating that this package has built-in type declarations

3.1.11 • Public • Published

Installation

npm install --save @types/feathersjs__socket-commons

Summary

This package contains type definitions for @feathersjs/socket-commons (https://github.com/feathersjs/socket-commons).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/feathersjs__socket-commons.

import { HookContext } from "@feathersjs/feathers";

export type Connection = any; // todo: spec connection

export interface Channel {
    join(...connections: Connection[]): this;

    leave(...connections: Connection[]): this;

    filter(callback: (connection: Connection) => boolean): Channel;

    send(data: any): this;
}

declare module "@feathersjs/feathers" {
    interface ServiceAddons<T> {
        // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
        publish(callback: (data: T, hook: HookContext<T>) => Channel | Channel[] | void): this;

        // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
        publish(event: string, callback: (data: T, hook: HookContext<T>) => Channel | Channel[] | void): this;
    }

    interface Application<ServiceTypes> {
        channels: string[];

        channel(name: string[]): Channel;
        channel(...names: string[]): Channel;

        // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
        publish<T>(callback: (data: T, hook: HookContext<T>) => Channel | Channel[] | void): Application<ServiceTypes>;

        publish<T>(
            event: string,
            // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
            callback: (data: T, hook: HookContext<T>) => Channel | Channel[] | void,
        ): Application<ServiceTypes>;
    }
}

Additional Details

Credits

These definitions were written by Jan Lohage, and deskoh.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/feathersjs__socket-commons

Weekly Downloads

151

Version

3.1.11

License

MIT

Unpacked Size

5.74 kB

Total Files

5

Last publish

Collaborators

  • types