[babel-plugin] add constKey/constVal to Rule type#1696
Merged
Conversation
The hand-written src/index.d.ts types a Rule's object as
`{ ltr: string; rtl?: null | string }`, but the Flow source (src/index.js)
also has optional `constKey` / `constVal` (used by defineConsts rules).
Consumers that read the rule objects returned to processStylexRules can't
access those fields type-safely without casting. Add them to match the
source of truth.
Extracted from the broader CJS-compat change in facebook#1322 so the type fix can
land on its own.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@henryqdineen is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
henryqdineen
added a commit
to henryqdineen/stylex
that referenced
this pull request
Jun 3, 2026
Resolve conflicts to keep this PR's CJS-compat (export =) restructure on top of current main. Uses main's current processStylexRules config (the useLayers object form) and leaves the Rule constKey/constVal fields to the separate facebook#1696, so the two PRs stay orthogonal.
mellyeliu
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed / motivation ?
The hand-written
packages/@stylexjs/babel-plugin/src/index.d.tstypes aRule's object as{ ltr: string; rtl?: null | string }, but the Flow source (src/index.js) also declares optionalconstKey/constVal(used bydefineConstsrules). Consumers reading the rule objects passed toprocessStylexRulescan't access those fields without casting.This adds
constKey?/constVal?to the.d.tsso it matches the Flow source of truth.Linked PR/Issues
Extracted from #1322, which bundles this same fix into a broader CJS-compat restructure — pulling the type change out so it can land on its own.
Additional Context
Type-only change.
prettier --checkpasses, and the added fields match the existing FlowRuletype insrc/index.js.Pre-flight checklist