mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
3.82k stars 1.14k forks source link

[DataGrid] Change isCellEditable params type #12896

Open atomheartother opened 3 weeks ago

atomheartother commented 3 weeks ago

Hi MUI-X team, thanks for your hard work.

I believe I have come across an incorrect type for isCellEditable's params, see the diff.

The bug

As the types currently are on master (and in production) , params.row is any, meaning any typo or wrong property on params.row won't be picked up by TS, despite users' efforts to type their grid strongly:

image

This also means params.value is, I believe, incorrectly typed, making it look like the value has the row's type (which it shouldn't):

image

The fix

With my fairly simple MR, Typescript understands what's happening and warns the user against potential bug:

image

That's pretty much it.

mui-bot commented 3 weeks ago

Deploy preview: https://deploy-preview-12896--material-ui-x.netlify.app/

Generated by :no_entry_sign: dangerJS against 05493a829d0f9d503fc5901870ce104c5ee3fa7a