diff --git a/app/actions/selectedUsers.ts b/app/actions/selectedUsers.ts index 607b3cebc..6924a5696 100644 --- a/app/actions/selectedUsers.ts +++ b/app/actions/selectedUsers.ts @@ -7,22 +7,22 @@ type TUser = { user: ISelectedUser; }; -type IAction = Action & TUser; +type TAction = Action & TUser; interface ISetLoading extends Action { loading: boolean; } -export type TActionSelectedUsers = IAction & ISetLoading; +export type TActionSelectedUsers = TAction & ISetLoading; -export function addUser(user: ISelectedUser): IAction { +export function addUser(user: ISelectedUser): TAction { return { type: types.SELECTED_USERS.ADD_USER, user }; } -export function removeUser(user: ISelectedUser): IAction { +export function removeUser(user: ISelectedUser): TAction { return { type: types.SELECTED_USERS.REMOVE_USER, user diff --git a/app/definitions/index.ts b/app/definitions/index.ts index ea8f9adb4..d8af539fd 100644 --- a/app/definitions/index.ts +++ b/app/definitions/index.ts @@ -1,8 +1,8 @@ import { StackNavigationProp } from '@react-navigation/stack'; import { Dispatch } from 'redux'; -export interface BaseScreen { - navigation: StackNavigationProp; +export interface IBaseScreen, S extends string> { + navigation: StackNavigationProp; dispatch: Dispatch; theme: string; } diff --git a/app/definitions/redux/index.ts b/app/definitions/redux/index.ts index e80221c8c..e95763e29 100644 --- a/app/definitions/redux/index.ts +++ b/app/definitions/redux/index.ts @@ -4,7 +4,7 @@ import { TActionActiveUsers } from '../../actions/activeUsers'; import { IActiveUsers } from '../../reducers/activeUsers'; import { ISelectedUsers } from '../../reducers/selectedUsers'; -export interface ApplicationState { +export interface IApplicationState { settings: any; login: any; meteor: any; @@ -28,4 +28,4 @@ export interface ApplicationState { roles: any; } -export type ApplicationActions = TActionActiveUsers & TActionSelectedUsers; +export type TApplicationActions = TActionActiveUsers & TActionSelectedUsers; diff --git a/app/reducers/activeUsers.ts b/app/reducers/activeUsers.ts index cd189fb67..9877a5ceb 100644 --- a/app/reducers/activeUsers.ts +++ b/app/reducers/activeUsers.ts @@ -1,4 +1,4 @@ -import { ApplicationActions } from '../definitions'; +import { TApplicationActions } from '../definitions'; import { SET_ACTIVE_USERS } from '../actions/actionsTypes'; type TUserStatus = 'online' | 'offline'; @@ -13,7 +13,7 @@ export interface IActiveUsers { export const initialState: IActiveUsers = {}; -export default function activeUsers(state = initialState, action: ApplicationActions): IActiveUsers { +export default function activeUsers(state = initialState, action: TApplicationActions): IActiveUsers { switch (action.type) { case SET_ACTIVE_USERS: return { diff --git a/app/reducers/selectedUsers.ts b/app/reducers/selectedUsers.ts index e2be6b9a6..f6573ac9e 100644 --- a/app/reducers/selectedUsers.ts +++ b/app/reducers/selectedUsers.ts @@ -1,4 +1,4 @@ -import { ApplicationActions } from '../definitions'; +import { TApplicationActions } from '../definitions'; import { SELECTED_USERS } from '../actions/actionsTypes'; export interface ISelectedUser { @@ -20,7 +20,7 @@ export const initialState: ISelectedUsers = { loading: false }; -export default function (state = initialState, action: ApplicationActions): ISelectedUsers { +export default function (state = initialState, action: TApplicationActions): ISelectedUsers { switch (action.type) { case SELECTED_USERS.ADD_USER: return { diff --git a/app/views/SelectedUsersView.tsx b/app/views/SelectedUsersView.tsx index 85b86afe4..8962555f3 100644 --- a/app/views/SelectedUsersView.tsx +++ b/app/views/SelectedUsersView.tsx @@ -14,7 +14,7 @@ import Loading from '../containers/Loading'; import SafeAreaView from '../containers/SafeAreaView'; import SearchBox from '../containers/SearchBox'; import StatusBar from '../containers/StatusBar'; -import { ApplicationState, BaseScreen } from '../definitions'; +import { IApplicationState, IBaseScreen } from '../definitions'; import I18n from '../i18n'; import database from '../lib/database'; import RocketChat from '../lib/rocketchat'; @@ -36,7 +36,7 @@ interface ISelectedUsersViewState { chats: ISelectedUser[]; } -interface ISelectedUsersViewProps extends BaseScreen { +interface ISelectedUsersViewProps extends IBaseScreen { route: RouteProp; // REDUX STATE users: ISelectedUser[]; @@ -296,7 +296,7 @@ class SelectedUsersView extends React.Component ({ +const mapStateToProps = (state: IApplicationState) => ({ baseUrl: state.server.server, users: state.selectedUsers.users, loading: state.selectedUsers.loading,