facebook / facebook/stylex

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

Open
#735 0 comments 0 reactions 1 assignee Claimed by @nmn View on GitHub
enhancement
Dominant language
JavaScript
Stars
10.3k
Forks
481
Avg merge
3d 8h
Merged PRs (30d)
13

Description

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 `null`ish.

However, there are certain expressions that are statically know to never be `null`ish. 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.