Skip to content

TableHeaderProps.columns should be readonly T[] instead of T[] #5625

@sbdchd

Description

@sbdchd

Provide a general summary of the issue here

Basically to make types work better I as const the columns, which causes the <Row types to be better (I get a union of literals), but TableHeaderProps errors since it expects a mutable array

🤔 Expected Behavior?

Allow readonly arrays being passed

😯 Current Behavior

Readonly arrays not allowed

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

The type 'readonly [{ readonly id: "teamName"; readonly name: "Team"; }, { readonly id: "creator"; readonly name: "Creator"; }, { readonly id: "createdAt"; readonly name: "Created"; }, { readonly id: "status"; readonly name: "Status"; }]' is 'readonly' and cannot be assigned to the mutable type 'object[]'.ts(4104)
types.d.ts(1740, 5): The expected type comes from property 'columns' which is declared here on type 'IntrinsicAttributes & TableHeaderProps<object> & RefAttributes<HTMLTableSectionElement>'
(property) TableHeaderProps<object>.columns?: object[] | undefined
const columns = [{id: 1, col1: "col1"}] as const;
<TableHeader columns={columns}>
() => <div/>
</TableHeader>

Version

1.0.0

What browsers are you seeing the problem on?

Safari

If other, please specify.

No response

What operating system are you using?

Mac OS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions