Skip to content

Commit 24a735a

Browse files
committed
[DataGrid] Make more props readonly arrays instead of mutable arrays
1 parent ed3472b commit 24a735a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/x-data-grid/src/models/api/gridRowSelectionApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export interface GridRowSelectionApi {
3131
/**
3232
* Updates the selected rows to be those passed to the `rowIds` argument.
3333
* Any row already selected will be unselected.
34-
* @param {GridRowId[]} rowIds The row ids to select.
34+
* @param {readonly GridRowId[]} rowIds The row ids to select.
3535
*/
36-
setRowSelectionModel: (rowIds: GridRowId[]) => void;
36+
setRowSelectionModel: (rowIds: readonly GridRowId[]) => void;
3737
}
3838

3939
export interface GridRowMultiSelectionApi {

packages/x-data-grid/src/models/colDef/gridColDef.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
134134
/**
135135
* The order of the sorting sequence.
136136
*/
137-
sortingOrder?: GridSortDirection[];
137+
sortingOrder?: readonly GridSortDirection[];
138138
/**
139139
* If `true`, the column is resizable.
140140
* @default true
@@ -264,7 +264,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
264264
/**
265265
* Allows setting the filter operators for this column.
266266
*/
267-
filterOperators?: GridFilterOperator<R, V, F>[];
267+
filterOperators?: readonly GridFilterOperator<R, V, F>[];
268268
/**
269269
* The callback that generates a filtering function for a given quick filter value.
270270
* This function can return `null` to skip filtering for this value and column.
@@ -306,9 +306,9 @@ export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F
306306
/**
307307
* Function that returns the actions to be shown.
308308
* @param {GridRowParams} params The params for each row.
309-
* @returns {React.ReactElement<GridActionsCellItemProps>[]} An array of [[GridActionsCell]] elements.
309+
* @returns {readonly React.ReactElement<GridActionsCellItemProps>[]} An array of [[GridActionsCell]] elements.
310310
*/
311-
getActions: (params: GridRowParams<R>) => React.ReactElement<GridActionsCellItemProps>[];
311+
getActions: (params: GridRowParams<R>) => readonly React.ReactElement<GridActionsCellItemProps>[];
312312
}
313313

314314
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { GridRowId } from './gridRows';
22

3-
export type GridInputRowSelectionModel = GridRowId[] | GridRowId;
3+
export type GridInputRowSelectionModel = readonly GridRowId[] | GridRowId;
44

5-
export type GridRowSelectionModel = GridRowId[];
5+
export type GridRowSelectionModel = readonly GridRowId[];

0 commit comments

Comments
 (0)