mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 04:13:02 +00:00
Adjust DataTable types.
- Make key in `cell` slot prop less strict to prevent type errors in markup. - Resolve property path names up to one level deep for header keys.
This commit is contained in:
parent
aa45b63ff1
commit
2b6c7b0ade
7 changed files with 73 additions and 21 deletions
|
@ -926,7 +926,8 @@ None.
|
|||
### Types
|
||||
|
||||
```ts
|
||||
export type DataTableKey<Row = DataTableRow> = Exclude<keyof Row, "id">;
|
||||
export type DataTableKey<Row = DataTableRow> =
|
||||
import("./DataTableTypes.d.ts").PropertyPath<Row>;
|
||||
|
||||
export type DataTableValue = any;
|
||||
|
||||
|
@ -962,7 +963,7 @@ export interface DataTableRow {
|
|||
export type DataTableRowId = any;
|
||||
|
||||
export interface DataTableCell<Row = DataTableRow> {
|
||||
key: DataTableKey<Row>;
|
||||
key: DataTableKey<Row> | (string & {});
|
||||
value: DataTableValue;
|
||||
display?: (item: Value, row: DataTableRow) => DataTableValue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue