[PR #4369] [MERGED] 👷 Typescript: Improving typing of asyncStorage (global-store.json) #5346

Closed
opened 2026-02-28 21:10:58 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4369
Author: @MikesGlitch
Created: 2/12/2025
Status: Merged
Merged: 2/19/2025
Merged by: @MikesGlitch

Base: masterHead: ts/globalprefs


📝 Commits (4)

📊 Changes

7 files changed (+70 additions, -18 deletions)

View changed files

📝 packages/loot-core/src/platform/server/asyncStorage/index.d.ts (+20 -6)
📝 packages/loot-core/src/platform/server/asyncStorage/index.electron.ts (+7 -4)
📝 packages/loot-core/src/platform/server/asyncStorage/index.testing.ts (+8 -4)
📝 packages/loot-core/src/platform/server/asyncStorage/index.web.ts (+5 -2)
📝 packages/loot-core/src/server/main.ts (+2 -2)
📝 packages/loot-core/src/types/prefs.d.ts (+22 -0)
upcoming-release-notes/4369.md (+6 -0)

📄 Description

Problem:

Every setting from global-store.json was being treated like a string and then parsed. There are values in the global-store.json that aren't strings. E.g. did-bootstrap

I've added a new type to represent the global-store.json file as it currently stands. The existing GlobalStore represents the values after they have been parsed.

This makes it a lot easier to add more complex types/types that aren't just strings. It also gives us intellisense/type safety on the prefs functions (e.g. multiGet).

This should help me out in https://github.com/actualbudget/actual/pull/4357 where I want to add a global-store setting like:

syncServerSettings: {
   port: 5007,
   autoStart: true,
   ngrok: {
      token: 'thetoken',
      domain: 'thengrokdomain.com'
   }
}

test

#1483


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/4369 **Author:** [@MikesGlitch](https://github.com/MikesGlitch) **Created:** 2/12/2025 **Status:** ✅ Merged **Merged:** 2/19/2025 **Merged by:** [@MikesGlitch](https://github.com/MikesGlitch) **Base:** `master` ← **Head:** `ts/globalprefs` --- ### 📝 Commits (4) - [`e8b38d2`](https://github.com/actualbudget/actual/commit/e8b38d213e9411aef03bb06aaac5fff2c450adeb) typing globalprefs - [`ed2330d`](https://github.com/actualbudget/actual/commit/ed2330d46dfdfe1417f93e5799330a3104615375) adding release notes - [`cfbec63`](https://github.com/actualbudget/actual/commit/cfbec6325c0a733693aad10a082874c3055c72d8) unneeded partial - [`d2d197e`](https://github.com/actualbudget/actual/commit/d2d197e4a47ecfd2ba3e9e68d2e2e8c057d75129) removing prop that crept in ### 📊 Changes **7 files changed** (+70 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/platform/server/asyncStorage/index.d.ts` (+20 -6) 📝 `packages/loot-core/src/platform/server/asyncStorage/index.electron.ts` (+7 -4) 📝 `packages/loot-core/src/platform/server/asyncStorage/index.testing.ts` (+8 -4) 📝 `packages/loot-core/src/platform/server/asyncStorage/index.web.ts` (+5 -2) 📝 `packages/loot-core/src/server/main.ts` (+2 -2) 📝 `packages/loot-core/src/types/prefs.d.ts` (+22 -0) ➕ `upcoming-release-notes/4369.md` (+6 -0) </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes --> ### Problem: Every setting from global-store.json was being treated like a string and then parsed. There are values in the global-store.json that aren't strings. E.g. ```did-bootstrap``` I've added a new type to represent the global-store.json file as it currently stands. The existing GlobalStore represents the values after they have been parsed. This makes it a lot easier to add more complex types/types that aren't just strings. It also gives us intellisense/type safety on the prefs functions (e.g. multiGet). This should help me out in https://github.com/actualbudget/actual/pull/4357 where I want to add a global-store setting like: ``` syncServerSettings: { port: 5007, autoStart: true, ngrok: { token: 'thetoken', domain: 'thengrokdomain.com' } } ``` ![test](https://github.com/user-attachments/assets/e598e60b-94b4-4176-9352-453403b0c770) #1483 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:10:58 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5346