Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: babel-plugin exports static methods type #102

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/babel-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type Options = StyleXOptions;
/**
* Entry point for the StyleX babel plugin.
*/
export default function styleXTransform(): PluginObj<> {
function styleXTransform(): PluginObj<> {
// To simplify state management, we use a StateManager object to abstract
// away some of the details.
let state: StateManager;
Expand Down Expand Up @@ -302,3 +302,12 @@ function addSpecificityLevel(selector: string, index: number): string {

return `${beforeCurly}${pseudo}${afterCurly}`;
}

export type StyleXTransformObj = {
(): PluginObj<>,
withOptions: typeof styleXTransform.withOptions,
processStylexRules: typeof processStylexRules,
...
};
Comment on lines +306 to +311
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type StyleXTransformObj = {
(): PluginObj<>,
withOptions: typeof styleXTransform.withOptions,
processStylexRules: typeof processStylexRules,
...
};
export type StyleXTransformObj = $ReadOnly<{
(): PluginObj<>,
withOptions: typeof styleXTransform.withOptions,
processStylexRules: typeof processStylexRules,
...
}>;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer the type to be read-only if possible.


export default (styleXTransform: StyleXTransformObj);
Loading