I'm using the CSS typings from csstype to set CSS style objects. However, I'd like to allow a CSS property to be null.
From what I understand, this should work:
import * as CSS from "csstype";
type CSSProperties = CSS.Properties<number | string>;
type CSSObject = CSSProperties & { [K in keyof CSSProperties]: CSSProperties[K] | null };
let k: CSSObject = {
background: null
};
However, I get an error that Type 'null' is not assignable to type 'string | number | undefined'.. I essentially want CSSObject to have all the same keys as CSS.Properties, but with each key also allowing a null value.