mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 17:47:00 -05:00
Remove duplication of CrossoverData type (#6928)
* Remove duplication of CrossoverData type Move the CrossoverData type definition to crossover-spreadsheet.tsx and import it from the Crossover and CrossoverCard files instead of having duplicate definitions in each file. Signed-off-by: Jonathon Jongsma <jonathon@quotidian.org> * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Signed-off-by: Jonathon Jongsma <jonathon@quotidian.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -41,6 +41,7 @@ import { Header } from '@desktop-client/components/reports/Header';
|
||||
import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';
|
||||
import { calculateTimeRange } from '@desktop-client/components/reports/reportRanges';
|
||||
import { createCrossoverSpreadsheet } from '@desktop-client/components/reports/spreadsheets/crossover-spreadsheet';
|
||||
import type { CrossoverData } from '@desktop-client/components/reports/spreadsheets/crossover-spreadsheet';
|
||||
import { useReport } from '@desktop-client/components/reports/useReport';
|
||||
import { useAccounts } from '@desktop-client/hooks/useAccounts';
|
||||
import { useCategories } from '@desktop-client/hooks/useCategories';
|
||||
@@ -52,30 +53,6 @@ import { useWidget } from '@desktop-client/hooks/useWidget';
|
||||
import { addNotification } from '@desktop-client/notifications/notificationsSlice';
|
||||
import { useDispatch } from '@desktop-client/redux';
|
||||
|
||||
// Type for the return value of the recalculate function
|
||||
type CrossoverData = {
|
||||
graphData: {
|
||||
data: Array<{
|
||||
x: string;
|
||||
investmentIncome: number;
|
||||
expenses: number;
|
||||
nestEgg: number;
|
||||
adjustedExpenses?: number;
|
||||
isProjection?: boolean;
|
||||
}>;
|
||||
start: string;
|
||||
end: string;
|
||||
crossoverXLabel: string | null;
|
||||
};
|
||||
lastKnownBalance: number;
|
||||
lastKnownMonthlyIncome: number;
|
||||
lastKnownMonthlyExpenses: number;
|
||||
historicalReturn: number | null;
|
||||
yearsToRetire: number | null;
|
||||
targetMonthlyIncome: number | null;
|
||||
targetNestEgg: number | null;
|
||||
};
|
||||
|
||||
export const defaultTimeFrame = {
|
||||
start: monthUtils.subMonths(monthUtils.currentMonth(), 120),
|
||||
end: monthUtils.subMonths(monthUtils.currentMonth(), 1),
|
||||
|
||||
@@ -18,35 +18,12 @@ import { ReportCard } from '@desktop-client/components/reports/ReportCard';
|
||||
import { ReportCardName } from '@desktop-client/components/reports/ReportCardName';
|
||||
import { calculateTimeRange } from '@desktop-client/components/reports/reportRanges';
|
||||
import { createCrossoverSpreadsheet } from '@desktop-client/components/reports/spreadsheets/crossover-spreadsheet';
|
||||
import type { CrossoverData } from '@desktop-client/components/reports/spreadsheets/crossover-spreadsheet';
|
||||
import { useReport } from '@desktop-client/components/reports/useReport';
|
||||
import { useWidgetCopyMenu } from '@desktop-client/components/reports/useWidgetCopyMenu';
|
||||
import { useFormat } from '@desktop-client/hooks/useFormat';
|
||||
import { useLocale } from '@desktop-client/hooks/useLocale';
|
||||
|
||||
// Type for the return value of the recalculate function
|
||||
type CrossoverData = {
|
||||
graphData: {
|
||||
data: Array<{
|
||||
x: string;
|
||||
investmentIncome: number;
|
||||
expenses: number;
|
||||
nestEgg: number;
|
||||
adjustedExpenses?: number;
|
||||
isProjection?: boolean;
|
||||
}>;
|
||||
start: string;
|
||||
end: string;
|
||||
crossoverXLabel: string | null;
|
||||
};
|
||||
lastKnownBalance: number;
|
||||
lastKnownMonthlyIncome: number;
|
||||
lastKnownMonthlyExpenses: number;
|
||||
historicalReturn: number | null;
|
||||
yearsToRetire: number | null;
|
||||
targetMonthlyIncome: number | null;
|
||||
targetNestEgg: number | null;
|
||||
};
|
||||
|
||||
type CrossoverCardProps = {
|
||||
widgetId: string;
|
||||
isEditing?: boolean;
|
||||
|
||||
@@ -49,6 +49,30 @@ function calculateHampelFilteredMedian(expenses: number[]): number {
|
||||
return calculateMedian(filteredExpenses);
|
||||
}
|
||||
|
||||
// Type for the return value of the recalculate function
|
||||
export type CrossoverData = {
|
||||
graphData: {
|
||||
data: Array<{
|
||||
x: string;
|
||||
investmentIncome: number;
|
||||
expenses: number;
|
||||
nestEgg: number;
|
||||
adjustedExpenses?: number;
|
||||
isProjection?: boolean;
|
||||
}>;
|
||||
start: string;
|
||||
end: string;
|
||||
crossoverXLabel: string | null;
|
||||
};
|
||||
lastKnownBalance: number;
|
||||
lastKnownMonthlyIncome: number;
|
||||
lastKnownMonthlyExpenses: number;
|
||||
historicalReturn: number | null;
|
||||
yearsToRetire: number | null;
|
||||
targetMonthlyIncome: number | null;
|
||||
targetNestEgg: number | null;
|
||||
};
|
||||
|
||||
export type CrossoverParams = {
|
||||
start: string;
|
||||
end: string;
|
||||
|
||||
6
upcoming-release-notes/6928.md
Normal file
6
upcoming-release-notes/6928.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [jonner]
|
||||
---
|
||||
|
||||
Remove duplicate type definition for CrossoverData
|
||||
Reference in New Issue
Block a user