I have: But that gives me an error: Type ‘boolean | null’ is not assignable to type ‘boolean | undefined’. It seems that a MUI Modal takes boolean | undefined whereas the PropType has it has boolean | null. How can I reconcile that? Answer Option 1: Check for null: or you can also use ??: Option 2: Omit &
Tag: react-proptypes
How to remove Object is possibly ‘null’ TS2531 warning when using PropTypes.InferProps and default parameters?
I have a simple React component that adds two numbers together. It’s written in TypeScript and using @types/prop-types. Typescript complains that first and second could possibly be ‘null’ ts(2531), but they have default parameter values. Making these PropTypes.number.isRequired will obviously make the warning go away, but I don’t want them required. I know I can make this warning go away