refactor: replace () => JSX.Element with React.ComponentType (#120)

This commit is contained in:
Marco Pasqualetti
2024-11-18 21:45:27 +01:00
committed by GitHub
parent 957d08701f
commit 55490579ec
3 changed files with 10 additions and 4 deletions
@@ -3,7 +3,11 @@ import { AppShell } from '@mantine/core'
import SidebarLink from './sidebar-link'
export default function Sidebar({ close }: { close: () => void }): JSX.Element {
interface SidebarProps {
close: () => void
}
export default function Sidebar({ close }: SidebarProps): JSX.Element {
return (
<AppShell.Navbar p="md">
<SidebarLink
+2 -2
View File
@@ -1,4 +1,4 @@
import type { JSX } from 'react'
import type { ComponentType as ReactComponentType } from 'react'
import { trimPath, trimPathRight } from './utils'
import type { Route } from './route'
@@ -12,7 +12,7 @@ interface CreateRouter {
}
interface RouteOptions {
component?: () => JSX.Element
component?: ReactComponentType
hasHandler?: boolean
routeTree?: RouteTree
}
+3 -1
View File
@@ -1,3 +1,5 @@
import type { ComponentType as ReactComponentType } from 'react'
export interface Segment {
type: 'pathname' | 'param' | 'wildcard'
value: string
@@ -17,6 +19,6 @@ export interface RouteProps {
isLoading: boolean
}
export type RouteComponent = ((props: RouteProps) => JSX.Element) & {
export type RouteComponent = ReactComponentType<RouteProps> & {
preload: () => void
}