Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [TypeScript] Make runQuery generic #4238

Closed
wants to merge 4 commits into from
Closed

Conversation

joel-jeremy
Copy link
Contributor

@joel-jeremy joel-jeremy commented Jan 24, 2025

This PR is to make the runQuery function generic to make it easy to type DB query results and propagate the proper types from the bottom up.

There are some minimal changes just to help TypeScript infer types better but other than that, most of the changes are just annotating the query functions with the correct return types.

Note: We have 2 runQuerys in the codebase. One is for AQL (server/aql folder) and the other is for direct DB access (server/db folder). This PR is for the latter.

@actual-github-bot actual-github-bot bot changed the title [TypeScript] Make runQuery generic [WIP] [TypeScript] Make runQuery generic Jan 24, 2025
Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit f515ed8
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6797fc92bc69bc00086ea45a
😎 Deploy Preview https://deploy-preview-4238.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Jan 24, 2025

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
15 6.68 MB → 6.68 MB (-304 B) -0.00%
Changeset
File Δ Size
src/components/autocomplete/AccountAutocomplete.tsx 📈 +40 B (+0.80%) 4.88 kB → 4.91 kB
home/runner/work/actual/actual/packages/loot-core/src/client/accounts/accountsSlice.ts 📈 +20 B (+0.39%) 5.07 kB → 5.09 kB
home/runner/work/actual/actual/packages/loot-core/src/client/data-hooks/schedules.tsx 📈 +2 B (+0.06%) 3.01 kB → 3.01 kB
src/components/modals/CategoryGroupMenuModal.tsx 📈 +2 B (+0.03%) 6.26 kB → 6.26 kB
locale/en.json 📈 +31 B (+0.03%) 99.31 kB → 99.34 kB
src/components/schedules/ScheduleDetails.tsx 📉 -7 B (-0.02%) 30.84 kB → 30.84 kB
locale/uk.json 📉 -80 B (-0.07%) 111.19 kB → 111.11 kB
locale/pt-BR.json 📉 -97 B (-0.09%) 103.38 kB → 103.29 kB
locale/en-GB.json 📉 -104 B (-0.11%) 92.98 kB → 92.87 kB
locale/nl.json 📉 -111 B (-0.19%) 58.58 kB → 58.47 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 4.28 MB → 4.28 MB (+57 B) +0.00%
static/js/en.js 99.31 kB → 99.34 kB (+31 B) +0.03%

Smaller

Asset File Size % Changed
static/js/nl.js 58.58 kB → 58.47 kB (-111 B) -0.19%
static/js/en-GB.js 92.98 kB → 92.87 kB (-104 B) -0.11%
static/js/pt-BR.js 103.38 kB → 103.29 kB (-97 B) -0.09%
static/js/uk.js 111.19 kB → 111.11 kB (-80 B) -0.07%

Unchanged

Asset File Size % Changed
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/AppliedFilters.js 10.52 kB 0%
static/js/useAccountPreviewTransactions.js 1.69 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 84.94 kB 0%
static/js/wide.js 102.8 kB 0%
static/js/ReportRouter.js 1.59 MB 0%

Copy link
Contributor

github-actions bot commented Jan 24, 2025

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.33 MB → 1.33 MB (+67 B) +0.00%
Changeset
File Δ Size
packages/loot-core/src/server/db/index.ts 📈 +142 B (+0.71%) 19.44 kB → 19.58 kB
packages/loot-core/src/mocks/budget.ts 📈 +75 B (+0.25%) 29.38 kB → 29.45 kB
packages/loot-core/src/server/schedules/find-schedules.ts 📈 +8 B (+0.07%) 11.35 kB → 11.36 kB
packages/loot-core/src/server/budget/base.ts 📈 +8 B (+0.05%) 14.95 kB → 14.96 kB
packages/loot-core/src/server/accounts/transaction-rules.ts 📈 +17 B (+0.05%) 31.91 kB → 31.92 kB
packages/loot-core/src/server/budget/actions.ts 📈 +5 B (+0.04%) 13.11 kB → 13.12 kB
packages/loot-core/src/server/sync/index.ts 📈 +6 B (+0.02%) 23.48 kB → 23.49 kB
packages/loot-core/src/server/main.ts 📉 -7 B (-0.01%) 69.5 kB → 69.49 kB
packages/loot-core/src/server/accounts/transfer.ts 📉 -4 B (-0.06%) 6.13 kB → 6.12 kB
packages/loot-core/src/server/tools/app.ts 📉 -3 B (-0.09%) 3.26 kB → 3.25 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.33 MB → 1.33 MB (+67 B) +0.00%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@joel-jeremy
Copy link
Contributor Author

Closing in favor of #4247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant