[PR #841] [MERGED] Convert loot-core to TS p1 #3357

Closed
opened 2026-02-28 20:40:24 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/841
Author: @albertogasparin
Created: 4/2/2023
Status: Merged
Merged: 4/3/2023
Merged by: @j-f1

Base: masterHead: chore/convert-core-ts-p1


📝 Commits (4)

📊 Changes

54 files changed (+210 additions, -58 deletions)

View changed files

📝 .eslintrc.js (+8 -2)
📝 packages/desktop-client/src/components/budget/MobileBudget.js (+1 -1)
📝 packages/desktop-client/src/components/budget/index.js (+1 -1)
📝 packages/desktop-client/src/components/schedules/StatusBadge.js (+1 -1)
📝 packages/loot-core/jest.config.js (+11 -3)
📝 packages/loot-core/jest.web.config.js (+4 -1)
📝 packages/loot-core/package.json (+1 -0)
📝 packages/loot-core/src/platform/exceptions/index.browser.ts (+0 -0)
packages/loot-core/src/platform/exceptions/index.d.ts (+2 -0)
📝 packages/loot-core/src/platform/exceptions/index.electron.ts (+0 -0)
📝 packages/loot-core/src/platform/exceptions/index.testing.ts (+0 -0)
📝 packages/loot-core/src/platform/exceptions/index.web.ts (+0 -0)
packages/loot-core/src/platform/server/fetch/index.d.ts (+5 -0)
📝 packages/loot-core/src/platform/server/fetch/index.electron.ts (+5 -5)
📝 packages/loot-core/src/platform/server/fetch/index.testing.ts (+0 -0)
📝 packages/loot-core/src/platform/server/fetch/index.web.ts (+0 -0)
📝 packages/loot-core/src/platform/server/fs/index.web.js (+1 -1)
packages/loot-core/src/platform/server/indexeddb/index.d.ts (+7 -0)
📝 packages/loot-core/src/platform/server/indexeddb/index.web.ts (+11 -6)
📝 packages/loot-core/src/platform/server/log/index.api.ts (+3 -1)

...and 34 more files

📄 Description

Part 1 of the conversion. Mostly renaming js to ts and making sure things make still sense. Added also handy TS ESLint rules.

In order to support the various .web/.electron/... I ended up adopting index.d.ts as pattern to share type definition. Let me know if that makes sense for you too. Right now the function type definition is duplicated, but the solution will be importing from index.d.ts and using const fn: FnDef = () => ... that way we can keep all variants in sync from a single type file.

Such rewrite however is better done in another PR otherwise we risk confusing git and loosing history (rename + too many changes). Another thing that might do in the next PR is convert all files to ESModules, as things get confusing between CJS exports, ESM default/named and TS adds extra complains.


🔄 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/841 **Author:** [@albertogasparin](https://github.com/albertogasparin) **Created:** 4/2/2023 **Status:** ✅ Merged **Merged:** 4/3/2023 **Merged by:** [@j-f1](https://github.com/j-f1) **Base:** `master` ← **Head:** `chore/convert-core-ts-p1` --- ### 📝 Commits (4) - [`16a2bde`](https://github.com/actualbudget/actual/commit/16a2bdee9d78fd4abfcd7e73171c1dfaebad070d) Convert loot-core to TS p1 - [`1d255ce`](https://github.com/actualbudget/actual/commit/1d255cee3ea2231f94edaea0f31940d3ddae5c31) Address PR comments - [`65786ec`](https://github.com/actualbudget/actual/commit/65786ec435470112cf0def89ac4aa815b30faaa5) Fix logger types - [`3a47601`](https://github.com/actualbudget/actual/commit/3a47601c43549ebfe7cec69438184c87e927b40c) Add number casting ### 📊 Changes **54 files changed** (+210 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `.eslintrc.js` (+8 -2) 📝 `packages/desktop-client/src/components/budget/MobileBudget.js` (+1 -1) 📝 `packages/desktop-client/src/components/budget/index.js` (+1 -1) 📝 `packages/desktop-client/src/components/schedules/StatusBadge.js` (+1 -1) 📝 `packages/loot-core/jest.config.js` (+11 -3) 📝 `packages/loot-core/jest.web.config.js` (+4 -1) 📝 `packages/loot-core/package.json` (+1 -0) 📝 `packages/loot-core/src/platform/exceptions/index.browser.ts` (+0 -0) ➕ `packages/loot-core/src/platform/exceptions/index.d.ts` (+2 -0) 📝 `packages/loot-core/src/platform/exceptions/index.electron.ts` (+0 -0) 📝 `packages/loot-core/src/platform/exceptions/index.testing.ts` (+0 -0) 📝 `packages/loot-core/src/platform/exceptions/index.web.ts` (+0 -0) ➕ `packages/loot-core/src/platform/server/fetch/index.d.ts` (+5 -0) 📝 `packages/loot-core/src/platform/server/fetch/index.electron.ts` (+5 -5) 📝 `packages/loot-core/src/platform/server/fetch/index.testing.ts` (+0 -0) 📝 `packages/loot-core/src/platform/server/fetch/index.web.ts` (+0 -0) 📝 `packages/loot-core/src/platform/server/fs/index.web.js` (+1 -1) ➕ `packages/loot-core/src/platform/server/indexeddb/index.d.ts` (+7 -0) 📝 `packages/loot-core/src/platform/server/indexeddb/index.web.ts` (+11 -6) 📝 `packages/loot-core/src/platform/server/log/index.api.ts` (+3 -1) _...and 34 more files_ </details> ### 📄 Description Part 1 of the conversion. Mostly renaming js to ts and making sure things make still sense. Added also handy TS ESLint rules. In order to support the various .web/.electron/... I ended up adopting `index.d.ts` as pattern to share type definition. Let me know if that makes sense for you too. Right now the function type definition is duplicated, but the solution will be importing from `index.d.ts` and using `const fn: FnDef = () => ...` that way we can keep all variants in sync from a single type file. Such rewrite however is better done in another PR otherwise we risk confusing git and loosing history (rename + too many changes). Another thing that might do in the next PR is convert all files to ESModules, as things get confusing between CJS exports, ESM default/named and TS adds extra complains. --- <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 20:40:24 -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#3357