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

TypeScript migration (partial). #1671

Closed
wants to merge 10 commits into from
Closed

Conversation

doggan
Copy link
Contributor

@doggan doggan commented Sep 7, 2023

Working through some of the TypeScript migrations/hardening when running yarn tsc --strict.

Found 3531 errors in 249 files. -> Found 3500 errors in 240 files.

Related: #1483

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit f4a7c75
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/64fa75996efe7e0008bd8129
😎 Deploy Preview https://deploy-preview-1671.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.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

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
16 2.46 MB → 2.46 MB (-25 B) -0.00%
Changeset
File Δ Size
src/hooks/useMergedRefs.ts 🆕 +494 B 0 B → 494 B
src/components/sidebar/ItemContent.tsx 📈 +7 B (+0.89%) 788 B → 795 B
src/components/AnimatedRefresh.tsx 📈 +5 B (+0.74%) 677 B → 682 B
src/components/manager/subscribe/ChangePassword.tsx 📈 +12 B (+0.39%) 3.04 kB → 3.05 kB
src/components/manager/subscribe/Bootstrap.tsx 📈 +12 B (+0.32%) 3.69 kB → 3.7 kB
../loot-core/src/shared/transactions.ts 📈 +22 B (+0.27%) 8 kB → 8.03 kB
src/components/LoggedInUser.tsx 📈 +6 B (+0.17%) 3.49 kB → 3.5 kB
src/components/manager/ConfigServer.tsx 📈 +4 B (+0.05%) 7.26 kB → 7.26 kB
src/components/schedules/SchedulesTable.tsx 📈 +5 B (+0.04%) 12.58 kB → 12.59 kB
../loot-core/src/client/actions/budgets.ts 📈 +2 B (+0.03%) 7.75 kB → 7.75 kB
src/components/Notifications.tsx 📈 +2 B (+0.02%) 8.2 kB → 8.2 kB
src/components/manager/ImportActual.tsx 📈 +1 B (+0.02%) 4.71 kB → 4.71 kB
src/components/FatalError.tsx 📈 +1 B (+0.01%) 7.78 kB → 7.78 kB
../loot-core/src/shared/util.ts 📉 -62 B (-0.68%) 8.88 kB → 8.82 kB
src/components/sort.tsx 📉 -407 B (-10.94%) 3.63 kB → 3.23 kB
src/hooks/useMergedRefs.js 🔥 -494 B (-100%) 494 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/main.js 1.11 MB → 1.11 MB (+106 B) +0.01%

Smaller

Asset File Size % Changed
static/js/wide-components.chunk.js 125.46 kB → 125.33 kB (-131 B) -0.10%

Unchanged

Asset File Size % Changed
static/js/678.chunk.js 420.74 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/713.chunk.js 156.56 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/narrow-components.chunk.js 32.55 kB 0%
static/js/reports.chunk.js 28.65 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/389.chunk.js 12.76 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 903 B 0%

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

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
2 2.22 MB → 2.22 MB (-14 B) -0.00%
Changeset
File Δ Size
packages/loot-core/src/shared/transactions.ts 📈 +22 B (+0.27%) 8 kB → 8.03 kB
packages/loot-core/src/shared/util.ts 📉 -62 B (-0.68%) 8.88 kB → 8.82 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
kcab.worker.js 1.23 MB → 1.23 MB (-14 B) -0.00%

Unchanged

Asset File Size % Changed
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@doggan doggan marked this pull request as ready for review September 8, 2023 00:05
@doggan doggan marked this pull request as draft September 8, 2023 00:29
@@ -164,7 +164,7 @@ export function addSplitTransaction(transactions, id) {
if (!trans.is_parent) {
return trans;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making last into a typed generic in util.ts bubbled up type issues to transactions.ts. This is the only location in the codebase using last, so it seemed most practical to just remove it.

@doggan doggan marked this pull request as ready for review September 8, 2023 03:34
Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting to see all these TS improvements. I hope someday we will be fully TS compatible + strict :)

onError={setError}
onError={err => setError(err)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥜 nitpick: ‏I don't think this change is necessary

onError={setError}
onError={err => setError(err)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

await setServerUrl(null);
await setServerUrl('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔨 warning: ‏we need to keep null here.

if (url == null) {

await setServerUrl(null);
await setServerUrl('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -21,7 +21,7 @@ function ItemContent({
forceActive,
children,
}: ItemContentProps) {
return onClick ? (
return onClick || !to ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: ‏I don't think we need this change.

Comment on lines +9 to +10
to?: string;
onClick?: MouseEventHandler<HTMLDivElement>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question: ‏is it that there can be either to or onClick? But not both at the same time? If so - we could solve it by changing the types slightly.

(very poor naming chosen here intentionally as this is just an example)

type BaseProps = { style: CSSProperties };
type ItemContentProps = AProps | BProps;

type AProps = BaseProps & { to: string };
type BProps = BaseProps & { onClick: () => void }; 

@trafico-bot trafico-bot bot added ⚠️ Changes requested Pull Request needs changes before it can be reviewed again and removed 🔍 Ready for Review labels Sep 8, 2023
@doggan
Copy link
Contributor Author

doggan commented Sep 24, 2023

Thanks for the feedback. Going to close this PR for now since it is stale and some of the changes have already been addressed in other merged PRs.

@doggan doggan closed this Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ Changes requested Pull Request needs changes before it can be reviewed again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants