mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 10:14:53 -05:00
Make Account.tsx compatible with exactOptionalPropertyTypes (#4189)
* Make `Account.tsx` compatible with `exactOptionalPropertyTypes` * Add release notes
This commit is contained in:
committed by
GitHub
parent
a97471557b
commit
7791b7401e
@@ -153,11 +153,11 @@ function EmptyMessage({ onAdd }: EmptyMessageProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AllTransactionsProps = {
|
type AllTransactionsProps = {
|
||||||
account?: AccountEntity;
|
account?: AccountEntity | undefined;
|
||||||
transactions: TransactionEntity[];
|
transactions: TransactionEntity[];
|
||||||
balances: Record<string, { balance: number }> | null;
|
balances: Record<string, { balance: number }> | null;
|
||||||
showBalances?: boolean;
|
showBalances?: boolean | undefined;
|
||||||
filtered?: boolean;
|
filtered?: boolean | undefined;
|
||||||
children: (
|
children: (
|
||||||
transactions: TransactionEntity[],
|
transactions: TransactionEntity[],
|
||||||
balances: Record<string, { balance: number }> | null,
|
balances: Record<string, { balance: number }> | null,
|
||||||
@@ -265,7 +265,12 @@ function getField(field?: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AccountInternalProps = {
|
type AccountInternalProps = {
|
||||||
accountId?: AccountEntity['id'] | 'onbudget' | 'offbudget' | 'uncategorized';
|
accountId?:
|
||||||
|
| AccountEntity['id']
|
||||||
|
| 'onbudget'
|
||||||
|
| 'offbudget'
|
||||||
|
| 'uncategorized'
|
||||||
|
| undefined;
|
||||||
filterConditions: RuleConditionEntity[];
|
filterConditions: RuleConditionEntity[];
|
||||||
showBalances?: boolean;
|
showBalances?: boolean;
|
||||||
setShowBalances: (newValue: boolean) => void;
|
setShowBalances: (newValue: boolean) => void;
|
||||||
@@ -280,7 +285,7 @@ type AccountInternalProps = {
|
|||||||
newTransactions: Array<TransactionEntity['id']>;
|
newTransactions: Array<TransactionEntity['id']>;
|
||||||
matchedTransactions: Array<TransactionEntity['id']>;
|
matchedTransactions: Array<TransactionEntity['id']>;
|
||||||
splitsExpandedDispatch: ReturnType<typeof useSplitsExpanded>['dispatch'];
|
splitsExpandedDispatch: ReturnType<typeof useSplitsExpanded>['dispatch'];
|
||||||
expandSplits?: boolean;
|
expandSplits?: boolean | undefined;
|
||||||
savedFilters: TransactionFilterEntity[];
|
savedFilters: TransactionFilterEntity[];
|
||||||
onBatchEdit: ReturnType<typeof useTransactionBatchActions>['onBatchEdit'];
|
onBatchEdit: ReturnType<typeof useTransactionBatchActions>['onBatchEdit'];
|
||||||
onBatchDuplicate: ReturnType<
|
onBatchDuplicate: ReturnType<
|
||||||
@@ -306,7 +311,7 @@ type AccountInternalProps = {
|
|||||||
type AccountInternalState = {
|
type AccountInternalState = {
|
||||||
search: string;
|
search: string;
|
||||||
filterConditions: ConditionEntity[];
|
filterConditions: ConditionEntity[];
|
||||||
filterId?: SavedFilter;
|
filterId?: SavedFilter | undefined;
|
||||||
filterConditionsOp: 'and' | 'or';
|
filterConditionsOp: 'and' | 'or';
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
workingHard: boolean;
|
workingHard: boolean;
|
||||||
@@ -314,10 +319,10 @@ type AccountInternalState = {
|
|||||||
transactions: TransactionEntity[];
|
transactions: TransactionEntity[];
|
||||||
transactionCount: number;
|
transactionCount: number;
|
||||||
transactionsFiltered?: boolean;
|
transactionsFiltered?: boolean;
|
||||||
showBalances?: boolean;
|
showBalances?: boolean | undefined;
|
||||||
balances: Record<string, { balance: number }> | null;
|
balances: Record<string, { balance: number }> | null;
|
||||||
showCleared?: boolean;
|
showCleared?: boolean | undefined;
|
||||||
prevShowCleared?: boolean;
|
prevShowCleared?: boolean | undefined;
|
||||||
showReconciled: boolean;
|
showReconciled: boolean;
|
||||||
editingName: boolean;
|
editingName: boolean;
|
||||||
nameError: string;
|
nameError: string;
|
||||||
@@ -326,8 +331,8 @@ type AccountInternalState = {
|
|||||||
sort: {
|
sort: {
|
||||||
ascDesc: 'asc' | 'desc';
|
ascDesc: 'asc' | 'desc';
|
||||||
field: string;
|
field: string;
|
||||||
prevField?: string;
|
prevField?: string | undefined;
|
||||||
prevAscDesc?: 'asc' | 'desc';
|
prevAscDesc?: 'asc' | 'desc' | undefined;
|
||||||
} | null;
|
} | null;
|
||||||
filteredAmount: null | number;
|
filteredAmount: null | number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useAccounts } from './useAccounts';
|
|||||||
import { usePayees } from './usePayees';
|
import { usePayees } from './usePayees';
|
||||||
|
|
||||||
type UseAccountPreviewTransactionsProps = {
|
type UseAccountPreviewTransactionsProps = {
|
||||||
accountId?: AccountEntity['id'];
|
accountId?: AccountEntity['id'] | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UseAccountPreviewTransactionsResult = {
|
type UseAccountPreviewTransactionsResult = {
|
||||||
@@ -73,25 +73,26 @@ function accountPreview({
|
|||||||
}: AccountPreviewProps): TransactionEntity[] {
|
}: AccountPreviewProps): TransactionEntity[] {
|
||||||
return transactions.map(transaction => {
|
return transactions.map(transaction => {
|
||||||
const inverse = transaction.account !== accountId;
|
const inverse = transaction.account !== accountId;
|
||||||
|
const subtransactions = transaction.subtransactions?.map(st => ({
|
||||||
|
...st,
|
||||||
|
amount: inverse ? -st.amount : st.amount,
|
||||||
|
payee:
|
||||||
|
(inverse ? getPayeeByTransferAccount(st.account)?.id : st.payee) || '',
|
||||||
|
account: inverse
|
||||||
|
? getTransferAccountByPayee(st.payee)?.id || ''
|
||||||
|
: st.account,
|
||||||
|
}));
|
||||||
return {
|
return {
|
||||||
...transaction,
|
...transaction,
|
||||||
amount: inverse ? -transaction.amount : transaction.amount,
|
amount: inverse ? -transaction.amount : transaction.amount,
|
||||||
payee: inverse
|
payee:
|
||||||
? getPayeeByTransferAccount(transaction.account)?.id || ''
|
(inverse
|
||||||
: transaction.payee,
|
? getPayeeByTransferAccount(transaction.account)?.id
|
||||||
|
: transaction.payee) || '',
|
||||||
account: inverse
|
account: inverse
|
||||||
? getTransferAccountByPayee(transaction.payee)?.id || ''
|
? getTransferAccountByPayee(transaction.payee)?.id || ''
|
||||||
: transaction.account,
|
: transaction.account,
|
||||||
subtransactions: transaction.subtransactions?.map(st => ({
|
...(subtransactions && { subtransactions }),
|
||||||
...st,
|
|
||||||
amount: inverse ? -st.amount : st.amount,
|
|
||||||
payee: inverse
|
|
||||||
? getPayeeByTransferAccount(st.account)?.id || ''
|
|
||||||
: st.payee,
|
|
||||||
account: inverse
|
|
||||||
? getTransferAccountByPayee(st.payee)?.id || ''
|
|
||||||
: st.account,
|
|
||||||
})),
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ type BatchDeleteProps = {
|
|||||||
|
|
||||||
type BatchLinkScheduleProps = {
|
type BatchLinkScheduleProps = {
|
||||||
ids: Array<TransactionEntity['id']>;
|
ids: Array<TransactionEntity['id']>;
|
||||||
account?: AccountEntity;
|
account?: AccountEntity | undefined;
|
||||||
onSuccess?: (
|
onSuccess?: (
|
||||||
ids: Array<TransactionEntity['id']>,
|
ids: Array<TransactionEntity['id']>,
|
||||||
schedule: ScheduleEntity,
|
schedule: ScheduleEntity,
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ type FinanceModals = {
|
|||||||
'category-autocomplete': {
|
'category-autocomplete': {
|
||||||
categoryGroups?: CategoryGroupEntity[];
|
categoryGroups?: CategoryGroupEntity[];
|
||||||
onSelect: (categoryId: string, categoryName: string) => void;
|
onSelect: (categoryId: string, categoryName: string) => void;
|
||||||
month?: string;
|
month?: string | undefined;
|
||||||
showHiddenCategories?: boolean;
|
showHiddenCategories?: boolean;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
};
|
};
|
||||||
@@ -315,7 +315,7 @@ type FinanceModals = {
|
|||||||
confirmReason: string;
|
confirmReason: string;
|
||||||
};
|
};
|
||||||
'confirm-transaction-delete': {
|
'confirm-transaction-delete': {
|
||||||
message?: string;
|
message?: string | undefined;
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
};
|
};
|
||||||
'edit-user': {
|
'edit-user': {
|
||||||
|
|||||||
6
upcoming-release-notes/4189.md
Normal file
6
upcoming-release-notes/4189.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Maintenance
|
||||||
|
authors: [jfdoming]
|
||||||
|
---
|
||||||
|
|
||||||
|
Make `Account.tsx` compatible with `exactOptionalPropertyTypes`
|
||||||
Reference in New Issue
Block a user