[PR #4189] [MERGED] Make Account.tsx compatible with exactOptionalPropertyTypes #67616

Closed
opened 2026-05-14 02:01:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4189
Author: @jfdoming
Created: 1/18/2025
Status: ✅ Merged
Merged: 1/21/2025
Merged by: @jfdoming

Base: master ← Head: jfdoming/exactOptionalPropertyTypes-1


📝 Commits (2)

  • 0c66b52 Make Account.tsx compatible with exactOptionalPropertyTypes
  • 67f0737 Add release notes

📊 Changes

5 files changed (+40 additions, -28 deletions)

View changed files

📝 packages/desktop-client/src/components/accounts/Account.tsx (+16 -11)
📝 packages/desktop-client/src/hooks/useAccountPreviewTransactions.ts (+15 -14)
📝 packages/desktop-client/src/hooks/useTransactionBatchActions.ts (+1 -1)
📝 packages/loot-core/src/client/state-types/modals.d.ts (+2 -2)
➕ upcoming-release-notes/4189.md (+6 -0)

📄 Description

From https://github.com/actualbudget/actual/pull/4186, I discovered it would be useful to enable exactOptionalPropertyTypes to prevent similar issues in the future. However, doing so requires updates in quite a few places, and interacts weirdly with the following pattern in React:

type ComponentProps = {
  ...
  prop?: string;
}

...

<Component
  ...
  prop={cond ? "abc" : undefined}
/>

The easiest fix for conditional props is to change the prop type to:

type ComponentProps = {
  ...
  prop?: string | undefined;
}

Opening this PR to get feedback on whether we can accept this slight degradation in dev experience in exchange for better type safety.


🔄 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/4189 **Author:** [@jfdoming](https://github.com/jfdoming) **Created:** 1/18/2025 **Status:** ✅ Merged **Merged:** 1/21/2025 **Merged by:** [@jfdoming](https://github.com/jfdoming) **Base:** `master` ← **Head:** `jfdoming/exactOptionalPropertyTypes-1` --- ### 📝 Commits (2) - [`0c66b52`](https://github.com/actualbudget/actual/commit/0c66b529c0f7d056d7940e5f3bed6904248ae837) Make `Account.tsx` compatible with `exactOptionalPropertyTypes` - [`67f0737`](https://github.com/actualbudget/actual/commit/67f07377abdb11d4d8a3748755030634dc64cd99) Add release notes ### 📊 Changes **5 files changed** (+40 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/accounts/Account.tsx` (+16 -11) 📝 `packages/desktop-client/src/hooks/useAccountPreviewTransactions.ts` (+15 -14) 📝 `packages/desktop-client/src/hooks/useTransactionBatchActions.ts` (+1 -1) 📝 `packages/loot-core/src/client/state-types/modals.d.ts` (+2 -2) ➕ `upcoming-release-notes/4189.md` (+6 -0) </details> ### 📄 Description From https://github.com/actualbudget/actual/pull/4186, I discovered it would be useful to enable `exactOptionalPropertyTypes` to prevent similar issues in the future. However, doing so requires updates in quite a few places, and interacts weirdly with the following pattern in React: ```tsx type ComponentProps = { ... prop?: string; } ... <Component ... prop={cond ? "abc" : undefined} /> ``` The easiest fix for conditional props is to change the prop type to: ```tsx type ComponentProps = { ... prop?: string | undefined; } ``` Opening this PR to get feedback on whether we can accept this slight degradation in dev experience in exchange for better type safety. --- <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-05-14 02:01:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#67616