Add type annotations
This commit is contained in:
parent
653b8f6352
commit
683e5b6abe
|
@ -32,7 +32,7 @@ describe('Streaming', () => {
|
||||||
p.on('message', message => {
|
p.on('message', message => {
|
||||||
if (message === 'ok') {
|
if (message === 'ok') {
|
||||||
(p.channel as any).onread = () => {};
|
(p.channel as any).onread = () => {};
|
||||||
initDb(true).then(async connection => {
|
initDb(true).then(async (connection: any) => {
|
||||||
Followings = connection.getRepository(Following);
|
Followings = connection.getRepository(Following);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ describe('Streaming', () => {
|
||||||
p.kill();
|
p.kill();
|
||||||
});
|
});
|
||||||
|
|
||||||
const follow = async (follower, followee) => {
|
const follow = async (follower: any, followee: any) => {
|
||||||
await Followings.save({
|
await Followings.save({
|
||||||
id: 'a',
|
id: 'a',
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
|
|
|
@ -76,7 +76,7 @@ export const uploadFile = (user: any, path?: string): Promise<any> => new Promis
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export function connectStream(user: any, channel: string, listener: any, params?: any): Promise<WebSocket> {
|
export function connectStream(user: any, channel: string, listener: (message: Record<string, any>) => any, params?: any): Promise<WebSocket> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
const ws = new WebSocket(`ws://localhost/streaming?i=${user.token}`);
|
const ws = new WebSocket(`ws://localhost/streaming?i=${user.token}`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue