Skip to content

Commit

Permalink
fix: Typescript errors for Switch and Table (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmar authored Sep 26, 2023
1 parent 987ceee commit 9c295d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, useRef } from 'react'
import { type ComponentProps, useMemo, useRef } from 'react'
import { useToggleState } from 'react-stately'
import {
type AriaSwitchProps,
Expand Down Expand Up @@ -26,7 +26,7 @@ type UseSwitchProps = Omit<
}

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

const SwitchSC = styled.label<SwitchStyleProps>(
({ $checked, $disabled, $readOnly, theme }) => ({
Expand Down
3 changes: 2 additions & 1 deletion src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
FilterFn,
Row,
SortDirection,
TableOptions,
} from '@tanstack/react-table'
import {
flexRender,
Expand Down Expand Up @@ -64,7 +65,7 @@ export type TableProps = Omit<
Parameters<typeof useVirtualizer>,
'parentRef' | 'size'
>
reactTableOptions?: Omit<Parameters<typeof useReactTable>, 'data' | 'columns'>
reactTableOptions?: Partial<Omit<TableOptions<any>, 'data' | 'columns'>>
onRowClick?: (e: MouseEvent<HTMLTableRowElement>, row: Row<any>) => void
}

Expand Down
4 changes: 2 additions & 2 deletions src/stories/Table.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createColumnHelper } from '@tanstack/react-table'
import { Div, Flex, Input, type InputProps, P } from 'honorable'
import React, { type ReactElement, useEffect } from 'react'
import React, { type ComponentProps, type ReactElement, useEffect } from 'react'
import type { Row } from '@tanstack/react-table'

import {
Expand Down Expand Up @@ -235,7 +235,7 @@ function DebouncedInput({
)
}

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

return (
Expand Down

0 comments on commit 9c295d9

Please sign in to comment.