-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[refactor] Migrate Discover schedules to tsx #1946
[refactor] Migrate Discover schedules to tsx #1946
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller
Unchanged
|
Bundle Stats — loot-coreHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Exciting to see the TypeScript migration coming along. Thanks for your work on this! I pointed out some things that we should work on fixing, but apart from that LGTM!
packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx
Outdated
Show resolved
Hide resolved
packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx
Outdated
Show resolved
Hide resolved
payee: PayeeEntity['id']; | ||
date: ScheduleEntity['_date']; | ||
amount: ScheduleEntity['_amount']; | ||
_conditions: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔨 warning: this should use enum type instead of an array with specific values (_conditions: Array<A | B | C>
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it's 4 objects, but this might change to more or less in the future. We shouldn't tie the typings to the actual business logic.
Eventually I think we'll even get rid of this Conditions
typing and instead use a generic one across the entire product. But it'll take us some time to get there.. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't tie the typings to the actual business logic
Agree !!, however, doing it in (_conditions: Array<A | B | C>)
is not working here, what other ways would you suggest here 🤔 ? or should we keep it as Array<A | B | C>
for now to change it in future ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d9b8c03
to
ecad163
Compare
{ op: 'is'; field: 'account'; value: AccountEntity['id'] }, | ||
{ op: 'is'; field: 'payee'; value: PayeeEntity['id'] }, | ||
{ | ||
op: 'is' | 'isapprox'; | ||
field: 'date'; | ||
value: ScheduleEntity['_date']; | ||
}, | ||
{ | ||
op: 'is' | 'isapprox'; | ||
field: 'amount'; | ||
value: ScheduleEntity['_amount']; | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ op: 'is'; field: 'account'; value: AccountEntity['id'] }, | |
{ op: 'is'; field: 'payee'; value: PayeeEntity['id'] }, | |
{ | |
op: 'is' | 'isapprox'; | |
field: 'date'; | |
value: ScheduleEntity['_date']; | |
}, | |
{ | |
op: 'is' | 'isapprox'; | |
field: 'amount'; | |
value: ScheduleEntity['_amount']; | |
}, | |
]; | |
_conditions: Array< | |
| { op: 'is'; field: 'account'; value: AccountEntity['id'] } | |
| { op: 'is'; field: 'payee'; value: PayeeEntity['id'] } | |
| { | |
op: 'is' | 'isapprox'; | |
field: 'date'; | |
value: ScheduleEntity['_date']; | |
} | |
| { | |
op: 'is' | 'isapprox'; | |
field: 'amount'; | |
value: ScheduleEntity['_amount']; | |
} | |
>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use Array
instead of []
here. I'm quite surprised it doesn't fail in CI..
But here's a playground so you can see the difference between the two types: https://www.typescriptlang.org/play?#code/C4TwDgpgBAKgFgSwM4CEBOECGBrJUC8UA3gFBTlQBumANgK4QBcUA2mRRwD7FQD2YzAOTJBAbigAzBBBoATIZgDGi3nQB2wMVAC+7DuW5E+AqMKRapM+abCYQECFt0cAuiV0lQkWIiQB1XjRcAmI9KloGZgBBNDQ7AB4wrh5+IRFxSzkFZVUNJySKQ2M08wzpLJs7B3yOAD53EhIVNSRgKGBfAH0AdwQaGh7A7GZ4ZACgvEJSDmp6JlYC8iNU0xEAGkly60Fbe0cdNcWUkzNBDcztpRV1TQOj5ZP1zashXeq71wam3ha2juQen0BgAjDA4Ea+dBYYJTMKzSILfQUB4lM7PCo7Kr7bSHJFLYqrcznLbZa55D54lGEtEXV5YwQU8hubRAA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah !, My bad !!, Thank you :) 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much!
Relates to #1483
schedules/discover