stylex
stylex copied to clipboard
Detect Binary Expressions etc. as dynamic values that can never be `null`ish.
StyleX now applies both inline styles for variables and the static classNames associated with dynamic styles conditionally.
This is done to account for cases where the dynamic value may end up being nullish.
However, there are certain expressions that are statically know to never be nullish. Detect these expressions and remove the ternary expressions that are used for the dynamic styles they're used for.
An incomplete list of known non-null expressions:
- Binary
+expression - Binary
-expression - Unary
+/-expression - Any kind of non-empty string literal, including template strings.