Skip to content

A local-first personal finance app

[AI] Typescript: low hanging fruit (#7091)

Matiss Janis Aboltinscf05a7ea0157
diff --git a/packages/desktop-client/src/users/usersSlice.ts b/packages/desktop-client/src/users/usersSlice.ts
index 518d87bbb3..6a426d2d2f 100644
--- a/packages/desktop-client/src/users/usersSlice.ts
+++ b/packages/desktop-client/src/users/usersSlice.ts
@@ -60,7 +60,7 @@ export const signOut = createAppAsyncThunk(
);
type UsersState = {
- data: Awaited<ReturnType<Handlers['subscribe-get-user']>>;
+ data: Awaited<ReturnType<Handlers['subscribe-get-user']>> | null;
};
const initialState: UsersState = {
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.ts
index db119b286a..f8be545225 100644
--- a/packages/desktop-electron/index.ts
+++ b/packages/desktop-electron/index.ts
@@ -25,7 +25,7 @@ import type {
import { copy, exists, mkdir, remove } from 'fs-extra';
import promiseRetry from 'promise-retry';
-import type { GlobalPrefsJson } from '../loot-core/src/types/prefs';
+import type { GlobalPrefsJson } from 'loot-core/src/types/prefs';
import { getMenu } from './menu';
import {
diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.json
index 986ed2799c..5e379b3ecb 100644
--- a/packages/desktop-electron/package.json
+++ b/packages/desktop-electron/package.json
@@ -30,6 +30,7 @@
"cross-env": "^10.1.0",
"electron": "39.2.7",
"electron-builder": "26.4.0",
+ "loot-core": "workspace:*",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4"
},
diff --git a/packages/loot-core/src/platform/server/sqlite/index.electron.ts b/packages/loot-core/src/platform/server/sqlite/index.electron.ts
index 53d95121bc..fe13c7c371 100644
--- a/packages/loot-core/src/platform/server/sqlite/index.electron.ts
+++ b/packages/loot-core/src/platform/server/sqlite/index.electron.ts
@@ -100,7 +100,7 @@ function regexp(regex: string, text: string | null) {
return new RegExp(regex).test(text || '') ? 1 : 0;
}
-export function openDatabase(pathOrBuffer: string | Buffer) {
+export function openDatabase(pathOrBuffer: string | Buffer): SQL.Database {
const db = new SQL(pathOrBuffer);
// Define Unicode-aware LOWER, UPPER, and LIKE implementation.
// This is necessary because better-sqlite3 uses SQLite build without ICU support.
diff --git a/upcoming-release-notes/7091.md b/upcoming-release-notes/7091.md
new file mode 100644
index 0000000000..5b66fe3270
--- /dev/null
+++ b/upcoming-release-notes/7091.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+TypeScript: clean up some types
diff --git a/yarn.lock b/yarn.lock
index ab65d1cfb3..8f5a080c4d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -14415,6 +14415,7 @@ __metadata:
electron: "npm:39.2.7"
electron-builder: "npm:26.4.0"
fs-extra: "npm:^11.3.3"
+ loot-core: "workspace:*"
promise-retry: "npm:^2.0.1"
typescript: "npm:^5.9.3"
typescript-strict-plugin: "npm:^2.4.4"