-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data grid] Upgrading from data-grid 7.27.1 to 7.27.2 breaks code using GridSortModel #16760
Comments
Yes, this is because we changed the type for To prevent this you could just update that const sortModel = data.columns.reduce<GridSortModel>((acc, column) => {
if (column.type === 'string') {
return [...acc, { field: column.id, sort: column.sorting.order ? 'asc' : 'desc' }];
}
return acc;
}, []); Could you check if this works for you? |
This is related to #16731 - GridSortModel = GridSortItem[]
+ GridSortModel = readonly GridSortItem[] I'm not in the grid team, so could not tell if it's a breaking change or not, but a quick workaround could be to replace |
That could work as well @alexfauquette ... However, this will break again when upgrading to v8, since we made |
Thank you for your quick feedback! Yes, the "workaround" seems to work although:
|
I agree that this should have been a minor. Although it's arguable at best if types are considered an integral part to justify that. 🤷🏼
its only obvious if you cast the type onto the variable.
|
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @doberkofler How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
The following code snipped reports aTypeScript error
error TS2339: Property 'push' does not exist on type 'GridSortModel'
after upgrading from data-grid 7.27.1 to 7.27.2:Current behavior
error TS2339: Property 'push' does not exist on type 'GridSortModel'
Expected behavior
No breaking change between patch revisions
Context
No response
Your environment
npx @mui/envinfo
Search keywords: data-grid GridSortModel
The text was updated successfully, but these errors were encountered: