port js files in lib and lib/containers to ts (#3957)

* rename files in lib and lib/containers to ts

* add types

* fix ts errors
This commit is contained in:
Labhansh Agrawal 2019-11-11 20:51:42 +05:30 committed by Benjamin Staneck
parent d5d5bcc74c
commit a1eb84d8a7
17 changed files with 163 additions and 59 deletions

View file

@ -136,7 +136,7 @@ export function resizeSession(uid: string, cols: number, rows: number) {
};
}
export function onSearch(uid: string) {
export function onSearch(uid?: string) {
return (dispatch: Dispatch<any>, getState: () => HyperState) => {
const targetUid = uid || getState().sessions.activeUid;
dispatch({
@ -146,7 +146,7 @@ export function onSearch(uid: string) {
};
}
export function closeSearch(uid: string) {
export function closeSearch(uid?: string) {
return (dispatch: Dispatch<any>, getState: () => HyperState) => {
const targetUid = uid || getState().sessions.activeUid;
dispatch({
@ -156,7 +156,7 @@ export function closeSearch(uid: string) {
};
}
export function sendSessionData(uid: string, data: any, escaped: any) {
export function sendSessionData(uid: string | null, data: any, escaped?: any) {
return (dispatch: Dispatch<any>, getState: () => HyperState) => {
dispatch({
type: SESSION_USER_DATA,

View file

@ -170,7 +170,7 @@ export function moveLeft() {
type: UI_MOVE_LEFT,
effect() {
const state = getState();
const uid = state.termGroups.activeRootGroup;
const uid = state.termGroups.activeRootGroup!;
const groupUids = getGroupUids(state);
const index = groupUids.indexOf(uid);
const next = groupUids[index - 1] || groupUids[groupUids.length - 1];
@ -192,7 +192,7 @@ export function moveRight() {
effect() {
const state = getState();
const groupUids = getGroupUids(state);
const uid = state.termGroups.activeRootGroup;
const uid = state.termGroups.activeRootGroup!;
const index = groupUids.indexOf(uid);
const next = groupUids[index + 1] || groupUids[0];
if (!next || uid === next) {