diff --git a/app/definitions/IRocketChat.ts b/app/definitions/IRocketChat.ts new file mode 100644 index 00000000000..ed59b144d17 --- /dev/null +++ b/app/definitions/IRocketChat.ts @@ -0,0 +1,7 @@ +import rocketchat from '../lib/rocketchat'; + +type TRocketChat = typeof rocketchat; + +export interface IRocketChatThis extends TRocketChat { + sdk: any; +} diff --git a/app/lib/methods/canOpenRoom.ts b/app/lib/methods/canOpenRoom.ts index 0fb5a12e87f..70a9ea579ba 100644 --- a/app/lib/methods/canOpenRoom.ts +++ b/app/lib/methods/canOpenRoom.ts @@ -1,5 +1,6 @@ -import database from '../database'; +import { IRocketChatThis } from '../../definitions/IRocketChat'; import store from '../createStore'; +import database from '../database'; const restTypes = { channel: 'channels', @@ -13,7 +14,7 @@ enum ETypes { CHANNEL = 'channel' } -async function open(this: any, { type, rid, name }: { type: ETypes; rid: string; name: string }) { +async function open(this: IRocketChatThis, { type, rid, name }: { type: ETypes; rid: string; name: string }) { try { const params = rid ? { roomId: rid } : { roomName: name }; @@ -63,7 +64,7 @@ async function open(this: any, { type, rid, name }: { type: ETypes; rid: string; } export default async function canOpenRoom( - this: any, + this: IRocketChatThis, { rid, path, isCall }: { rid: string; isCall: boolean; path: string } ): Promise { try {