stylex icon indicating copy to clipboard operation
stylex copied to clipboard

Detect Binary Expressions etc. as dynamic values that can never be `null`ish.

Open nmn opened this issue 1 year ago • 0 comments

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.

nmn avatar Oct 09 '24 06:10 nmn