Chore: Migrate methods/getRoomInfo to TS (#3695)

* migrate getRoomInfo to TS

* update room type

* update types

* Fix lint error
This commit is contained in:
Gerzon Z 2022-02-18 22:09:05 -04:00 committed by GitHub
parent 4e24b7cd82
commit 1cfa45eeec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,8 @@
import { IRoom } from '../../definitions';
import { getSubscriptionByRoomId } from '../database/services/Subscription'; import { getSubscriptionByRoomId } from '../database/services/Subscription';
import RocketChat from '../rocketchat'; import RocketChat from '../rocketchat';
const getRoomInfo = async rid => { const getRoomInfo = async (rid: string): Promise<Pick<IRoom, 'rid' | 'name' | 'fname' | 't'> | null> => {
let result; let result;
result = await getSubscriptionByRoomId(rid); result = await getSubscriptionByRoomId(rid);
if (result) { if (result) {

View File

@ -32,6 +32,7 @@ import { isIOS } from '../../utils/deviceInfo';
import { compareServerVersion } from '../../lib/utils'; import { compareServerVersion } from '../../lib/utils';
import styles from './styles'; import styles from './styles';
import { InsideStackParamList, ChatsStackParamList } from '../../stacks/types'; import { InsideStackParamList, ChatsStackParamList } from '../../stacks/types';
import { IRoom } from '../../definitions';
import { IEmoji } from '../../definitions/IEmoji'; import { IEmoji } from '../../definitions/IEmoji';
const QUERY_SIZE = 50; const QUERY_SIZE = 50;
@ -81,7 +82,7 @@ class SearchMessagesView extends React.Component<ISearchMessagesViewProps, ISear
private encrypted: boolean | undefined; private encrypted: boolean | undefined;
private room: { rid: any; name: any; fname: any; t: any } | null | undefined; private room: Pick<IRoom, 'rid' | 'name' | 'fname' | 't'> | null | undefined;
static navigationOptions = ({ navigation, route }: INavigationOption) => { static navigationOptions = ({ navigation, route }: INavigationOption) => {
const options: StackNavigationOptions = { const options: StackNavigationOptions = {