mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[DataGrid] Change isCellEditable params type

Open atomheartother opened this issue 10 months ago • 1 comments

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.

atomheartother avatar Apr 24 '24 20:04 atomheartother

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

Generated by :no_entry_sign: dangerJS against 3ce1f66f0b16bb3a8e9db00e6929b9c025ee4f55

mui-bot avatar Apr 24 '24 20:04 mui-bot

Your additional fix makes total sense and no apology needed, all the effort is on you guys' side. Thanks for the review!

atomheartother avatar Jul 24 '24 13:07 atomheartother

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Jul 25 '24 22:07 github-actions[bot]