Style Engine: Export public TypeScript types#79079
Merged
senadir merged 4 commits intoJun 10, 2026
Merged
Conversation
Re-export the `Style`, `StyleOptions`, and `GeneratedCSSRule` types from the package entry point so consumers of `@wordpress/style-engine` can type their usage of `compileCSS` and `getCSSRules`. These are the types that appear in the public function signatures; internal helper types remain unexported, matching the convention used by `rich-text` and `components`. Each exported type is documented at the export site so the autogenerated API docs render a description, and the README is regenerated accordingly. Co-Authored-By: Claude Opus 4.8 <[email protected]>
92f2a01 to
9472c69
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
senadir
approved these changes
Jun 10, 2026
senadir
left a comment
Contributor
There was a problem hiding this comment.
This is looking fine apart the duplication in docs and maybe we need to run some sort or docs update script?
9472c69 to
48a66d4
Compare
Use a concise summary at each export (which docgen renders into the README) and a fuller description at each type definition (which IDE tooling surfaces on hover), so the two are no longer identical. Matches the pattern used by the `rich-text` and `worker-threads` packages. Co-Authored-By: Claude Opus 4.8 <[email protected]>
48a66d4 to
d1f2120
Compare
The `Style` interface gained a top-level `background` key; reword its
definition comment to mention backgrounds and phrase the property list as
non-exhaustive ("such as") so it stays accurate as the type evolves.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Document both functions with an @example JSDoc block so docgen renders a Usage example into the README's autogenerated API section. This makes the exported Style, StyleOptions and GeneratedCSSRule types learnable in context (selector vs. inline output, structured rules), with the example colocated with the code as a single source of truth rather than hand-written README prose. Outputs were verified against the package's behaviour. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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?
Re-exports the
Style,StyleOptions, andGeneratedCSSRuletypes from the@wordpress/style-engineentry point so consumers can type their usage ofcompileCSSandgetCSSRules.Why?
The package ships a
typesfield butsrc/index.tsonly exported the two functions, not the types in their signatures. Consumers work around this by deep-importing from source (e.g. WooCommerce imports from@wordpress/style-engine/src/types), which is fragile and not part of the published API. Other TS packages like@wordpress/rich-textand@wordpress/componentsalready export their public types this way.How?
export typestatements insrc/index.tsfor the three public-signature types (internal helpers stay unexported).README.mdand added a CHANGELOG entry.Testing Instructions
npx tsc --build packages/style-engine/tsconfig.json— completes without errors.packages/style-engine/build-types/index.d.tsre-exportsStyle,StyleOptions, andGeneratedCSSRule.import type { Style, StyleOptions, GeneratedCSSRule } from '@wordpress/style-engine';resolves without errors.Testing Instructions for Keyboard
N/A — types-only, no UI changes.
🤖 Generated with Claude Code