Closed nstepien closed 2 years ago
My first thought was that maybe it would be expected to fail so you're notified when something can be removed. But I guess you're right. This would be annoying:
let myColor: string | undefined;
if (someCondition) {
myColor: 'red';
}
const style: CSS.Properties = {
color: myColor, // Guess this would cause a type error?
}
Yes that's right.
You can also end up with code that looks like this
const style: CSS.Properties = {
color: records[key], // possibly undefined
background: [].find(() => false) // possibly undefined
}
Waiting for TS 4.4 support too.
Released in 3.0.10
TypeScript 4.4's release is around the corner, and I'm testing it right now. I'm hitting issues with
csstype
as properties are optional but do not explicitly allowundefined
, for exampleshould be
https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-rc/
Support for this would be nice.
For reference: https://github.com/adazzle/react-data-grid/pull/2566