Closed itsdouges closed 7 months ago
Latest commit: 810c7002ece6aa53837f2571c6bdc8c94bdd794b
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
This pull request refactors the types in and around the
createStrictAPI()
to fix a few bugs and underlying architectural issues. To prevent scope creeping the PR I haven't implemented nested styles for the strict API (e.g. hover inside an after pseudo) which may cause for another refactor. We can tackle that at a later date.This is to be merged before https://github.com/atlassian-labs/compiled/pull/1634 which then will build ontop of this one.
Background
Previously defining the schema came with a lot of redundant work. For every pseudo that you wanted to explicitly type you would have to define it, and then all of the base types again, like so:
If you missed a value / didn't type every pseudo it would fallback to the CSSProperties value (from
csstype
). This was mostly unexpected. So for example right now:hover
has been typed, but nothing else has. So it wouldn't benefit from the schema types.With this refactor it now always falls back to the top level types if not defined, meaning it's more expected and safe for everyone and you only need to type the values you want to explicitly support.
Dive into the pull request and check out my annotations for more information.
Extra notes