npm install --save @types/feathersjs__socket-commons
This package contains type definitions for @feathersjs/socket-commons (https://github.com/feathersjs/socket-commons).
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>;
}
}
- Last updated: Wed, 22 Nov 2023 00:24:48 GMT
- Dependencies: @types/feathersjs__feathers
These definitions were written by Jan Lohage, and deskoh.