frenic / csstype

Strict TypeScript and Flow types for style based on MDN data
MIT License
1.7k stars 69 forks source link

CSS Typed OM support #170

Open MrFoxPro opened 1 year ago

MrFoxPro commented 1 year ago

https://developer.chrome.com/blog/cssom/

https://ishoudinireadyyet.com/

https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/w3c-css-typed-object-model-level-1

style={{
   width: CSS.percent(100),
   height: CSS.percent(100),
}} // <- this is valid in Chromium

/* Type 'CSSUnitValue' is not assignable to type 'Width<0 | (string & {})>'.
  Type 'CSSUnitValue' is not assignable to type 'string & {}'.
    Type 'CSSUnitValue' is not assignable to type 'string'. */
MrFoxPro commented 1 year ago

As I understand it's possible right now with Generics:

csstype.PropertiesHyphen<CSSUnitValue | 0 | (string & {})>

Is it correct?