Skip to content

Commit

Permalink
Apply patches for strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 16, 2024
1 parent e07985a commit 267f03d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
} from 'loot-core/src/types/models';

const balanceTypeOptions = [
{ description: 'Payment', format: 'totalDebts' },
{ description: 'Deposit', format: 'totalAssets' },
{ description: 'Net', format: 'totalTotals' },
{ description: 'Payment', format: 'totalDebts' as const },
{ description: 'Deposit', format: 'totalAssets' as const },
{ description: 'Net', format: 'totalTotals' as const },
];

const groupByOptions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type ReportTableProps = {
handleScroll: UIEventHandler<HTMLDivElement>;
style?: CSSProperties;
groupBy: string;
balanceTypeOp: string;
balanceTypeOp: 'totalDebts' | 'totalTotals' | 'totalAssets';
data: GroupedEntity[];
mode: string;
monthsCount: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import React, { memo } from 'react';

import {
Expand All @@ -13,8 +12,8 @@ import { type GroupedEntity } from '../../entities';

type ReportTableRowProps = {
item: GroupedEntity;
balanceTypeOp?: string;
groupByItem: string;
balanceTypeOp: 'totalAssets' | 'totalDebts' | 'totalTotals';
groupByItem: 'id' | 'name';
mode: string;
style?: CSSProperties;
monthsCount: number;
Expand All @@ -29,7 +28,7 @@ export const ReportTableRow = memo(
style,
monthsCount,
}: ReportTableRowProps) => {
const average: number = amountToInteger(item[balanceTypeOp]) / monthsCount;
const average = amountToInteger(item[balanceTypeOp]) / monthsCount;
return (
<Row
collapsed={true}
Expand All @@ -41,7 +40,7 @@ export const ReportTableRow = memo(
>
<Cell
value={item[groupByItem]}
title={item[groupByItem].length > 12 && item[groupByItem]}
title={item[groupByItem].length > 12 ? item[groupByItem] : undefined}
style={{
width: 120,
flexShrink: 0,
Expand All @@ -59,8 +58,9 @@ export const ReportTableRow = memo(
}}
value={amountToCurrency(month[balanceTypeOp])}
title={
Math.abs(month[balanceTypeOp]) > 100000 &&
amountToCurrency(month[balanceTypeOp])
Math.abs(month[balanceTypeOp]) > 100000
? amountToCurrency(month[balanceTypeOp])
: undefined
}
width="flex"
privacyFilter
Expand All @@ -72,8 +72,9 @@ export const ReportTableRow = memo(
<Cell
value={amountToCurrency(item.totalAssets)}
title={
Math.abs(item.totalAssets) > 100000 &&
amountToCurrency(item.totalAssets)
Math.abs(item.totalAssets) > 100000
? amountToCurrency(item.totalAssets)
: undefined
}
width="flex"
privacyFilter
Expand All @@ -85,8 +86,9 @@ export const ReportTableRow = memo(
<Cell
value={amountToCurrency(item.totalDebts)}
title={
Math.abs(item.totalDebts) > 100000 &&
amountToCurrency(item.totalDebts)
Math.abs(item.totalDebts) > 100000
? amountToCurrency(item.totalDebts)
: undefined
}
width="flex"
privacyFilter
Expand All @@ -100,8 +102,9 @@ export const ReportTableRow = memo(
<Cell
value={amountToCurrency(item[balanceTypeOp])}
title={
Math.abs(item[balanceTypeOp]) > 100000 &&
amountToCurrency(item[balanceTypeOp])
Math.abs(item[balanceTypeOp]) > 100000
? amountToCurrency(item[balanceTypeOp])
: undefined
}
style={{
fontWeight: 600,
Expand All @@ -114,8 +117,9 @@ export const ReportTableRow = memo(
<Cell
value={integerToCurrency(Math.round(average))}
title={
Math.abs(Math.round(average / 100)) > 100000 &&
integerToCurrency(Math.round(average))
Math.abs(Math.round(average / 100)) > 100000
? integerToCurrency(Math.round(average))
: undefined
}
style={{
fontWeight: 600,
Expand Down

0 comments on commit 267f03d

Please sign in to comment.