Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Tweak the Stitches module

Mateusz Burzyńskia2a64dd33a13
diff --git a/packages/react-sdk/src/stitches/stitches.ts b/packages/react-sdk/src/stitches/stitches.ts
index 67662b3eb3..0154bed1e3 100644
--- a/packages/react-sdk/src/stitches/stitches.ts
+++ b/packages/react-sdk/src/stitches/stitches.ts
@@ -1,31 +1,30 @@
-import {
- createStitches,
- globalCss as globalCssImport,
- type CSS,
- css as createCss,
-} from "@stitches/core";
+import { createStitches, type CSS } from "@stitches/core";
import type { Breakpoint } from "../css";
let media = {};
-// @todo needs fixing
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-let stitches: any;
+const createStitchesInstance = () => createStitches({ media });
+
+type StitchesInstance = ReturnType<typeof createStitchesInstance>;
+
+let stitches: StitchesInstance | undefined;
export { type CSS };
const getCachedConfig = () => {
if (stitches === undefined) {
- stitches = createStitches({ media });
+ stitches = createStitchesInstance();
}
return stitches;
};
-export const css: typeof createCss = (...args) => {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export const css: StitchesInstance["css"] = (...args: any[]) => {
return getCachedConfig().css(...args);
};
-export const globalCss: typeof globalCssImport = (...args) => {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export const globalCss: StitchesInstance["globalCss"] = (...args: any[]) => {
return getCachedConfig().globalCss(...args);
};