fintraffic-design / fds-coreui-components

Fintraffic Design System's Core UI Components. Work heavily in progress.
European Union Public License 1.2
0 stars 0 forks source link

Table should use generics for setting item type #67

Open Haprog opened 7 months ago

Haprog commented 7 months ago

Currently if trying to use Table via a React wrapper for example TS forces the renderItem parameter type to plain object and will complain if you try to override the type to more specific type in the function signature. The only way to set the proper item type now is to create a local variable in the renderItem method and cast it to your item type like this:

<FdsTable
  ...
  renderItem={(_item) => {
    const item = _item as TableItem;
    return html`...`
  }}
/>

With generics TS should be able to infer the type based on type of items given.