[data grid] Column definition undefined
value
#14446
Labels
bug 🐛
Something doesn't work
component: data grid
This is the name of the generic UI component, not the React module!
Steps to reproduce
Link to live example:
https://codesandbox.io/p/sandbox/wispy-paper-mfjzqs?file=%2Fsrc%2FDemo.tsx%3A1%2C1-23%2C1
Current behavior
It crashes
filterOperators: undefined
overrides the default values of the column type. It likely does the same with a bunch of other properties.Expected behavior
It can be solved in two different ways. TypeScript flags
filterOperators: undefined,
as invalid. It's this issue: microsoft/TypeScript#13195 and this Stack Overflow question: https://stackoverflow.com/questions/67840542/object-with-optional-keys-but-with-a-mandatory-value-in-typescript. It can be enabled with https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes, but I suspect most projects are not using it, e.g. TypeScript maintainers consider it too much of a pain to have it in strict: microsoft/TypeScript#44421 (comment). So our only option seems to be ⬇️Or the grid sets the default value for undefined values, like components do e.g.
Context
I saw this in https://mui.zendesk.com/agent/tickets/19977.
Your environment
"@mui/x-data-grid-pro": "7.15.0",
Search keywords: -
The text was updated successfully, but these errors were encountered: