Skip to content

Commit

Permalink
fix: only 9 typing errors left (#437)
Browse files Browse the repository at this point in the history
* fix: first typing

* fix: only 10 typing errors left

* fix: till Found 9 errors.

* chore: remove unused line
  • Loading branch information
pure-js authored Jan 6, 2025
1 parent 53759a3 commit 3c25f61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
10 changes: 8 additions & 2 deletions apps/client/app/components/breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import { useMatches } from 'react-router';

import { breadcrumbs, crumb as StCrumb } from './breadcrumbs.css';

interface RouteHandle {
crumb: (data: unknown) => React.ReactNode;
}

function Breadcrumbs() {
const matches = useMatches();
const crumbs = matches
// first get rid of any matches that don't have handle and crumb
.filter((match) => Boolean(match.handle?.crumb))
.filter((match) =>
Boolean((match.handle as RouteHandle | undefined)?.crumb),
)
// now map them into an array of elements, passing the loader
// data to each one
.map((match) => match.handle.crumb(match.data));
.map((match) => (match.handle as RouteHandle).crumb(match.data));

return (
<div className="container mx-auto px-4">
Expand Down
6 changes: 3 additions & 3 deletions apps/client/app/components/post-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface IAuthor {
}

function Author({ userId }: IAuthor) {
const [name, setName] = useState();
const [username, setUsername] = useState();
const [name, setName] = useState<string>('');
const [username, setUsername] = useState<string>('');

async function authors() {
const currentAuthor = await db.authors.get(userId);
Expand Down Expand Up @@ -60,7 +60,7 @@ export interface BlogPostProps {
date?: string;
htmlDatetime?: string;
userId: string;
onDelete?: (arg0: string) => void;
onDelete: (id: number) => void;
}

export interface IUser {
Expand Down
7 changes: 1 addition & 6 deletions apps/client/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ const router = createBrowserRouter(
root.render(
<StrictMode>
<Suspense fallback={<>loading...</>}>
<RouterProvider
router={router}
future={{
v7_startTransition: true,
}}
/>
<RouterProvider router={router} />
</Suspense>
</StrictMode>,
);
2 changes: 1 addition & 1 deletion apps/client/app/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { timestampToLocaleString } from '~/services/timestamp-to-locale-string';
import type { IBlogPost } from '~/components/post-preview';
import PostPreview from '~/components/post-preview';

function handleDeleteStory(id: string) {
function handleDeleteStory(id: number) {
db.posts.delete(id);
}

Expand Down

0 comments on commit 3c25f61

Please sign in to comment.