Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/api/core/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ These are **core** options and API properties for the table. More options and AP
### `data`

```tsx
data: TData[]
data: readonly TData[]
```

The data for the table to display. This array should match the type you provided to `table.setRowType<...>`, but in theory could be an array of anything. It's common for each item in the array to be an object of key/values but this is not required. Columns can access this data via string/index or a functional accessor to return anything they want.
Expand All @@ -31,7 +31,7 @@ When the `data` option changes reference (compared via `Object.is`), the table w
### `columns`

```tsx
type columns = ColumnDef<TData>[]
type columns = readonly ColumnDef<TData>[]
```

The array of column defs to use for the table. See the [Column Def Guide](../../../guide/column-defs.md) for more information on creating column definitions.
Expand Down
8 changes: 4 additions & 4 deletions packages/table-core/src/core/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ export interface CoreOptions<TData extends RowData> {
* @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)
*/
columns: ColumnDef<TData, any>[]
columns: readonly ColumnDef<TData, any>[]
/**
* The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)
* @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)
*/
data: TData[]
data: readonly TData[]
/**
* Set this option to `true` to output all debugging information to the console.
* @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)
Expand Down Expand Up @@ -195,7 +195,7 @@ export interface CoreOptions<TData extends RowData> {
export interface CoreInstance<TData extends RowData> {
_features: readonly TableFeature[]
_getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>
_getColumnDefs: () => ColumnDef<TData, unknown>[]
_getColumnDefs: () => readonly ColumnDef<TData, unknown>[]
_getCoreRowModel?: () => RowModel<TData>
_getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>
_getRowId: (_: TData, index: number, parent?: Row<TData>) => string
Expand Down Expand Up @@ -447,7 +447,7 @@ export function createTable<TData extends RowData>(
() => [table._getColumnDefs()],
columnDefs => {
const recurseColumns = (
columnDefs: ColumnDef<TData, unknown>[],
columnDefs: readonly ColumnDef<TData, unknown>[],
parent?: Column<TData, unknown>,
depth = 0
): Column<TData, unknown>[] => {
Expand Down
2 changes: 1 addition & 1 deletion packages/table-core/src/utils/getCoreRowModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getCoreRowModel<TData extends RowData>(): (
}

const accessRows = (
originalRows: TData[],
originalRows: readonly TData[],
depth = 0,
parentRow?: Row<TData>
): Row<TData>[] => {
Expand Down
Loading