Skip to content

Commit

Permalink
typecheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Jan 22, 2024
1 parent 6c395cb commit d49d3dd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
11 changes: 9 additions & 2 deletions packages/desktop-client/src/components/reports/ReportOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ import {
type CategoryGroupEntity,
type PayeeEntity,
} from 'loot-core/src/types/models';
import { useCategories } from '../../hooks/useCategories';

const startDate = monthUtils.subMonths(monthUtils.currentMonth(), 5);
const endDate = monthUtils.currentMonth();
const categories = useCategories();

Check failure on line 13 in packages/desktop-client/src/components/reports/ReportOptions.ts

View workflow job for this annotation

GitHub Actions / lint

React Hook "useCategories" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function
const selectAll: CategoryEntity[] = [];
categories.grouped.map(categoryGroup =>

Check warning on line 15 in packages/desktop-client/src/components/reports/ReportOptions.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎··`
categoryGroup.categories &&

Check warning on line 16 in packages/desktop-client/src/components/reports/ReportOptions.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `··`
categoryGroup.categories.map(category => selectAll.push(category)),

Check warning on line 17 in packages/desktop-client/src/components/reports/ReportOptions.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `··`
);

export const defaultReport: CustomReportEntity = {
id: undefined,
Expand All @@ -23,9 +30,9 @@ export const defaultReport: CustomReportEntity = {
showEmpty: false,
showOffBudget: false,
showUncategorized: false,
selectedCategories: null,
selectedCategories: selectAll,
graphType: 'BarGraph',
conditions: null,
conditions: [],
conditionsOp: 'and',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function SaveReportMenu({
}: {
report: CustomReportEntity;
onClose: () => void;
onMenuSelect: (item) => void;
onMenuSelect: (item: string) => void;
savedStatus: string;
}) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { RefObject, useEffect } from 'react';

Check warning on line 1 in packages/desktop-client/src/components/reports/SaveReportName.tsx

View workflow job for this annotation

GitHub Actions / lint

Import "RefObject" is only used as types

import { theme } from '../../style';
import { Button } from '../common/Button';
Expand All @@ -11,10 +11,10 @@ import { FormField, FormLabel } from '../forms';
type SaveReportNameProps = {
onClose: () => void;
menuItem: string;
onNameChange;
inputRef;
onNameChange: (name: string) => void;
inputRef: RefObject<HTMLInputElement>;
onAddUpdate: () => void;
err;
err: string;
};

export function SaveReportName({
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/reports/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const reportModel = {
};

async function reportNameExists(
name: string,
name: string | undefined,
reportId: string | undefined,
newItem: boolean,
) {
Expand Down

0 comments on commit d49d3dd

Please sign in to comment.