Skip to content

Commit 9c295d9

Browse files
authored
fix: Typescript errors for Switch and Table (#519)
1 parent 987ceee commit 9c295d9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/components/Switch.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo, useRef } from 'react'
1+
import { type ComponentProps, useMemo, useRef } from 'react'
22
import { useToggleState } from 'react-stately'
33
import {
44
type AriaSwitchProps,
@@ -26,7 +26,7 @@ type UseSwitchProps = Omit<
2626
}
2727

2828
export type SwitchProps = UseSwitchProps &
29-
Pick<typeof SwitchSC, 'as' | 'className'>
29+
Pick<ComponentProps<typeof SwitchSC>, 'as'> & { className?: string }
3030

3131
const SwitchSC = styled.label<SwitchStyleProps>(
3232
({ $checked, $disabled, $readOnly, theme }) => ({

src/components/Table.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
FilterFn,
1919
Row,
2020
SortDirection,
21+
TableOptions,
2122
} from '@tanstack/react-table'
2223
import {
2324
flexRender,
@@ -64,7 +65,7 @@ export type TableProps = Omit<
6465
Parameters<typeof useVirtualizer>,
6566
'parentRef' | 'size'
6667
>
67-
reactTableOptions?: Omit<Parameters<typeof useReactTable>, 'data' | 'columns'>
68+
reactTableOptions?: Partial<Omit<TableOptions<any>, 'data' | 'columns'>>
6869
onRowClick?: (e: MouseEvent<HTMLTableRowElement>, row: Row<any>) => void
6970
}
7071

src/stories/Table.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createColumnHelper } from '@tanstack/react-table'
22
import { Div, Flex, Input, type InputProps, P } from 'honorable'
3-
import React, { type ReactElement, useEffect } from 'react'
3+
import React, { type ComponentProps, type ReactElement, useEffect } from 'react'
44
import type { Row } from '@tanstack/react-table'
55

66
import {
@@ -235,7 +235,7 @@ function DebouncedInput({
235235
)
236236
}
237237

238-
function FilterableTemplate(args: any) {
238+
function FilterableTemplate(args: ComponentProps<typeof Table>) {
239239
const [globalFilter, setGlobalFilter] = React.useState('')
240240

241241
return (

0 commit comments

Comments
 (0)