[types] Accept revert and revert-layer, and fix six properties that accept no CSS-wide keywords - #1884
Draft
henryqdineen wants to merge 2 commits into
Draft
[types] Accept revert and revert-layer, and fix six properties that accept no CSS-wide keywords#1884henryqdineen wants to merge 2 commits into
henryqdineen wants to merge 2 commits into
Conversation
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
henryqdineen
added this pull request to stack #1887
September 11, 2026 03:13
workflow: benchmarks/perfComparison of performance test results, measured in operations per second. Larger is better.
|
Worked example of the CSS-wide keyword loop: add the two missing keywords to
`GLOBAL_KEYWORDS`, and the test names every property that cannot take them.
display: does not accept 'revert', 'revert-layer'. Either compose the
`all` alias, or add it to NO_GLOBAL_KEYWORDS with a reason.
`revert` and `revert-layer` are CSS-wide keywords, valid on every property, but
the `all` alias that all 516 properties compose stopped at `unset`. `revert`
has been Baseline since 2021 and `revert-layer` since 2022; csstype has carried
both for years.
Fixed in one place, since `all` is the single definition. Pure widening -- no
value that used to typecheck stops doing so.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Worked example of emptying an allowlist: delete `NO_GLOBAL_KEYWORDS` and the
test names each property and what it is missing.
colorScheme: does not accept 'inherit', 'initial', 'unset', 'revert',
'revert-layer'. Every property should compose the `all` alias.
These six were written `null | 'a' | 'b'` rather than `all | 'a' | 'b'`, so
they accepted none of the CSS-wide keywords -- `colorScheme: 'inherit'` was a
type error, as were `marginTrim: 'unset'`, `paintOrder`, `textJustify`,
`WebkitBackgroundClip` and `WebkitBoxOrient`.
They are also the only six properties in the file with no named type alias:
everything else declares `type foo = ...` and writes `foo?: all | foo`, while
these inline their union at the property. Reaching for `null` -- what `all`
happens to start with -- instead of composing `all` is the slip that inlining
hid. Five date to the initial commit; `WebkitBackgroundClip` was added later by
"Chore: Allow additional -webkit- properties (#28)" and copied the shape.
Pure widening. The allowlist is now gone rather than shortened, so nothing can
reintroduce the pattern.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
henryqdineen
force-pushed
the
hqd-stylex-css-types-keywords
branch
from
September 11, 2026 03:15
a0dd0cd to
218d221
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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 ?
Two bugs, both found by the CSS-wide keyword test added in #1883.
revertandrevert-layerwere missing from every property. Theallalias that 516 properties compose stopped atunset.reverthas been Baseline since 2021 andrevert-layersince 2022; csstype has carried both for years. Fixed in one place, sinceallis the single definition.Six properties accepted none of the CSS-wide keywords — not even
inherit.colorScheme: 'inherit'was a type error, as weremarginTrim: 'unset',paintOrder,textJustify,WebkitBackgroundClipandWebkitBoxOrient. They were writtennull | 'a' | 'b'rather thanall | 'a' | 'b'.Linked PR/Issues
Stacked on #1883.
Additional Context
The cause of the second one is worth recording, because it explains why nobody noticed. Those six are the only properties in the file with no named type alias. Everything else declares
type foo = …and writesfoo?: all | foo; these inline their union at the property instead — and reaching fornull, which is whatallhappens to start with, rather than composingall, is the slip that inlining hid. Five date to the initial commit;WebkitBackgroundClipwas added later by "Chore: Allow additional -webkit- properties (#28)" and copied the shape.Both fixes are pure widenings: no value that used to typecheck stops doing so. Confirmed after the change that
color: 'revert-layer',colorScheme: 'inherit',marginTrim: 'unset'andpaintOrder: 'revert'all compile.The
NO_GLOBAL_KEYWORDSallowlist that #1883 introduced for these six is deleted rather than shortened, so the pattern cannot come back.Pre-flight checklist
Contribution Guidelines
🤖 Generated with Claude Code