Skip to content

Commit 8eb7879

Browse files
refactor: fix typescript issues
1 parent 89a12b1 commit 8eb7879

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

package/src/store/QuickSqliteClient.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,12 @@ export class QuickSqliteClient {
8383
};
8484

8585
static executeSql = (query: string, params?: string[]) => {
86-
this.openDB();
87-
8886
if (this.isQuickSqliteV4) {
8987
return QuickSqliteClient_v4.executeSql(query, params);
9088
}
9189

9290
try {
91+
this.openDB();
9392
const { rows } = sqlite.execute(DB_NAME, query, params);
9493
this.closeDB();
9594

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { mapStorableToTask } from '../mappers/mapStorableToTask';
22
import { QuickSqliteClient } from '../QuickSqliteClient';
33
import { createSelectQuery } from '../sqlite-utils/createSelectQuery';
4+
import type { TableRowJoinedUser } from '../types';
45

56
export const getPendingTasks = (conditions: { messageId?: string } = {}) => {
67
const query = createSelectQuery('pendingTasks', ['*'], conditions, {
@@ -9,5 +10,5 @@ export const getPendingTasks = (conditions: { messageId?: string } = {}) => {
910

1011
const result = QuickSqliteClient.executeSql.apply(null, query);
1112

12-
return result.map((r) => mapStorableToTask(r));
13+
return result.map((r: TableRowJoinedUser<'pendingTasks'>) => mapStorableToTask(r));
1314
};

package/src/store/apis/queries/selectChannels.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export const selectChannels = ({
1818
const result = QuickSqliteClient.executeSql.apply(null, query);
1919

2020
if (channelIds) {
21-
return result.sort((a, b) => channelIds.indexOf(a.cid) - channelIds.indexOf(b.cid));
21+
return result.sort(
22+
(a: { cid: string }, b: { cid: string }) =>
23+
channelIds.indexOf(a.cid) - channelIds.indexOf(b.cid),
24+
);
2225
} else {
2326
return result;
2427
}

package/src/store/apis/queries/selectMembersForChannels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ export const selectMembersForChannels = (cids: string[]): TableRowJoinedUser<'me
2828
cids,
2929
);
3030

31-
return result.map((r) => JSON.parse(r.value));
31+
return result.map((r: { value: string }) => JSON.parse(r.value));
3232
};

package/src/store/apis/queries/selectMessagesForChannels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ export const selectMessagesForChannels = (cids: string[]): TableRowJoinedUser<'m
3636
cids,
3737
);
3838

39-
return result.map((r) => JSON.parse(r.value));
39+
return result.map((r: { value: string }) => JSON.parse(r.value));
4040
};

package/src/store/apis/queries/selectReactionsForMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export const selectReactionsForMessages = (
2929
messageIds,
3030
);
3131

32-
return result.map((r) => JSON.parse(r.value));
32+
return result.map((r: { value: string }) => JSON.parse(r.value));
3333
};

package/src/store/apis/queries/selectReadsForChannels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ export const selectReadsForChannels = (cids: string[]): TableRowJoinedUser<'read
2626
cids,
2727
);
2828

29-
return result.map((r) => JSON.parse(r.value));
29+
return result.map((r: { value: string }) => JSON.parse(r.value));
3030
};

0 commit comments

Comments
 (0)