Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Binary Expressions etc. as dynamic values that can never be nullish. #735

Open
nmn opened this issue Oct 9, 2024 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@nmn
Copy link
Contributor

nmn commented Oct 9, 2024

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 nmn added the enhancement New feature or request label Oct 9, 2024
@nmn nmn self-assigned this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant