fix(@feathersjs/various): proper module augmentation, add reexports (#23195)

* fix feathersjs__{authentication-client,express,socket-commons}

* fix feathersjs__authentication-client
This commit is contained in:
Jan Lohage
2018-01-25 22:41:41 +01:00
committed by Andy
parent 5ec69dfcc8
commit 9dec8df964
9 changed files with 78 additions and 57 deletions

View File

@@ -1,18 +0,0 @@
declare module '@feathersjs/feathers' {
import { Channel } from '@feathersjs/socket-commons';
import { HookContext } from '@feathersjs/feathers';
export interface ServiceAddons<T> {
publish(callback: (data: T, hook: HookContext<T>) => Channel): this
publish(event: string, callback: (data: T, hook: HookContext<T>) => Channel): this
}
export interface Application<ServiceTypes = {}> {
channel(...names: string[]): Channel;
publish<T>(callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
publish<T>(event: string, callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
}
}

View File

@@ -1 +1,9 @@
const dummy: any = null;
import feathers from '@feathersjs/feathers';
const app = feathers();
app.channel('abc').send({});
// check if the non-augmented @feathersjs/feathers typings still work
app.on('asd', () => {});
app.service('asd').get(0).then(() => {});

View File

@@ -2,6 +2,34 @@
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
import './socket-commons';
import './feathers';
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> {
publish(callback: (data: T, hook: HookContext<T>) => Channel): this;
publish(event: string, callback: (data: T, hook: HookContext<T>) => Channel): this;
}
interface Application<ServiceTypes> {
channel(...names: string[]): Channel;
publish<T>(callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
publish<T>(event: string, callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
}
}

View File

@@ -1,13 +0,0 @@
declare module '@feathersjs/socket-commons' {
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;
}
}