tremorlabs / tremor

React components to build charts and dashboards
https://tremor.so
Apache License 2.0
15.39k stars 446 forks source link

[Bug]: `TableHeaderCell` has incorrect props type #998

Closed BenJenkinson closed 1 month ago

BenJenkinson commented 1 month ago

Tremor Version

3.14.1

Link to minimal reproduction

(See repro steps)

Steps to reproduce

This code:

<TableHeaderCell colSpan={3} /> // ❌ Property 'colSpan' does not exist

Produces this error:

Property 'colSpan' does not exist on type 'IntrinsicAttributes & HTMLAttributes & RefAttributes'.

What is expected?

The TableHeaderCell component extends React.ThHTMLAttributes<HTMLTableCellElement>.

The interface ThHTMLAttributes has the missing props for colSpan and similar

interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
    align?: "left" | "center" | "right" | "justify" | "char" | undefined;
    colSpan?: number | undefined;
    headers?: string | undefined;
    rowSpan?: number | undefined;
    scope?: string | undefined;
    abbr?: string | undefined;
}

What is actually happening?

The TableHeaderCell component only extends React.HTMLAttributes<HTMLTableCellElement>

https://github.com/tremorlabs/tremor/blob/bd6566b814d907e130b6827194def10b5bc3661f/src/components/list-elements/Table/TableHeaderCell.tsx#L5-L10

What browsers are you seeing the problem on?

Chrome

Any additional comments?

Unrecognised props (like colSpan here are passed through to the underlying <th>, so it does currently work; but Typescript isn't happy.

severinlandolt commented 1 month ago

Thanks @BenJenkinson! Added to the next release. The quality of your issue reports is what open-source maintainers dream of ✨

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 3.15.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 3.16.0-beta.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: