Skip to content

Commit 25b57d0

Browse files
authored
Merge pull request #878 from buildo/fix-table-cells-type
Fix Table cells types
2 parents c837bfc + be4a141 commit 25b57d0

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

packages/bento-design-system/src/Table/cells.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function ButtonCell({
2929
value: buttonProps,
3030
column: { align },
3131
options,
32-
}: CellProps<{}, Omit<ButtonProps, "size">> & {
32+
}: CellProps<any, Omit<ButtonProps, "size">> & {
3333
options: Partial<Pick<ButtonProps, "size">>;
3434
}) {
3535
const config = useBentoConfig().table;
@@ -48,7 +48,7 @@ export function ButtonLinkCell({
4848
value: buttonProps,
4949
column: { align },
5050
options,
51-
}: CellProps<{}, Omit<ButtonLinkProps, "size">> & {
51+
}: CellProps<any, Omit<ButtonLinkProps, "size">> & {
5252
options: Partial<Pick<ButtonLinkProps, "size">>;
5353
}) {
5454
const config = useBentoConfig().table;
@@ -67,7 +67,7 @@ export function TextCell({
6767
value,
6868
column: { align },
6969
options,
70-
}: CellProps<{}, LocalizedString> & {
70+
}: CellProps<any, LocalizedString> & {
7171
options: Partial<Pick<BodyProps, "size" | "weight" | "color">>;
7272
}) {
7373
const config = useBentoConfig().table;
@@ -87,7 +87,7 @@ export function TextWithIconCell({
8787
column: { align },
8888
options,
8989
}: CellProps<
90-
{},
90+
any,
9191
{
9292
icon: ((props: IconProps) => Children) | null;
9393
iconPosition: "left" | "right";
@@ -132,7 +132,7 @@ export function TextWithIconCell({
132132
);
133133
}
134134

135-
export function ChipCell({ value: chipProps, column: { align } }: CellProps<{}, ChipProps>) {
135+
export function ChipCell({ value: chipProps, column: { align } }: CellProps<any, ChipProps>) {
136136
const config = useBentoConfig().table;
137137
const padding = config.padding.chipCell ?? config.padding.defaultCell;
138138
return (
@@ -148,7 +148,7 @@ export function LabelCell({
148148
value,
149149
column: { align },
150150
options,
151-
}: CellProps<{}, LocalizedString> & {
151+
}: CellProps<any, LocalizedString> & {
152152
options: Partial<Pick<LabelProps, "size" | "color">>;
153153
}) {
154154
const config = useBentoConfig().table;
@@ -167,7 +167,7 @@ export function LinkCell({
167167
value,
168168
column: { align },
169169
options,
170-
}: CellProps<{}, ComponentProps<typeof Link>> & {
170+
}: CellProps<any, ComponentProps<typeof Link>> & {
171171
options: Partial<Pick<BodyProps, "size" | "weight">>;
172172
}) {
173173
const config = useBentoConfig().table;
@@ -186,7 +186,7 @@ export function IconCell({
186186
value,
187187
column: { align },
188188
options,
189-
}: CellProps<{}, { icon: (props: IconProps) => JSX.Element; label: LocalizedString }> & {
189+
}: CellProps<any, { icon: (props: IconProps) => JSX.Element; label: LocalizedString }> & {
190190
options: Partial<Pick<IconProps, "size" | "color">>;
191191
}) {
192192
const config = useBentoConfig().table;
@@ -203,7 +203,7 @@ export function IconButtonCell({
203203
value: iconButtonProps,
204204
column: { align },
205205
options,
206-
}: CellProps<{}, Omit<IconButtonProps, "size" | "kind" | "hierarchy">> & {
206+
}: CellProps<any, Omit<IconButtonProps, "size" | "kind" | "hierarchy">> & {
207207
options: Partial<Pick<IconButtonProps, "size" | "kind" | "hierarchy">>;
208208
}) {
209209
const config = useBentoConfig().table;

packages/bento-design-system/src/Table/tableColumn.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function textWithIcon<A extends string>({
146146
value: _value,
147147
...props
148148
}: CellProps<
149-
{},
149+
any,
150150
{
151151
icon: ((props: IconProps) => Children) | null;
152152
text: LocalizedString;
@@ -177,7 +177,7 @@ export function number<A extends string>({
177177
} & Partial<Pick<BodyProps, "size" | "weight" | "color">>) {
178178
return custom({
179179
...options,
180-
Cell: ({ value: numericValue, ...props }: CellProps<{}, number>) => {
180+
Cell: ({ value: numericValue, ...props }: CellProps<any, number>) => {
181181
const value = valueFormatter(numericValue);
182182
const textCellProps = {
183183
...props,
@@ -206,7 +206,7 @@ export function numberWithIcon<A extends string>({
206206
value: { numericValue, icon, tooltipContent },
207207
...props
208208
}: CellProps<
209-
{},
209+
any,
210210
{
211211
icon: ((props: IconProps) => Children) | null;
212212
numericValue: number;

packages/bento-design-system/stories/Components/Table.stories.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ const meta = {
445445
data: exampleData,
446446
},
447447
parameters: { actions: { argTypesRegex: "" } },
448-
} satisfies Meta<TableProps<typeof exampleColumns, typeof exampleGroupedColumns>>;
448+
} satisfies Meta<TableProps<typeof exampleColumns>>;
449449

450450
export default meta;
451451

@@ -526,6 +526,7 @@ export const WithFilter = {
526526
options={statusOptions}
527527
/>
528528
</FormRow>
529+
{/* @ts-expect-error */}
529530
<Story args={{ ...ctx.args, data }} />
530531
</Stack>
531532
);
@@ -598,6 +599,7 @@ export const Grouped = {
598599
} satisfies Story;
599600

600601
export const WithFillColumn = {
602+
// @ts-expect-error
601603
args: {
602604
columns: [
603605
tableColumn.text({
@@ -664,6 +666,7 @@ function repeatToLength<T>(arr: T[], n: number): T[] {
664666
}
665667

666668
export const VirtualizedRows = {
669+
// @ts-expect-error
667670
args: {
668671
stickyHeaders: true,
669672
height: { custom: 340 },
@@ -673,6 +676,7 @@ export const VirtualizedRows = {
673676
} satisfies Story;
674677

675678
export const VirtualizedRowsGroupedHeaders = {
679+
// @ts-expect-error
676680
args: {
677681
columns: exampleGroupedColumns,
678682
stickyHeaders: true,
@@ -683,6 +687,7 @@ export const VirtualizedRowsGroupedHeaders = {
683687
} satisfies Story;
684688

685689
export const VirtualizedRowsGroupedRows = {
690+
// @ts-expect-error
686691
args: {
687692
columns: [
688693
...exampleColumns,

0 commit comments

Comments
 (0)