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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: types
Andras Bacsaid8e264d136b7
diff --git a/packages/http-client/src/index.d.ts b/packages/http-client/src/index.d.tsindex 35bdc41498..e490f98882 100644--- a/packages/http-client/src/index.d.ts+++ b/packages/http-client/src/index.d.ts@@ -8,14 +8,16 @@ export type Page = {id: string;root: [string, string];};-export type Project = {- [string]:- | {- page: Page;- tree: BaseInstance;- props: Array<UserProp> | [];- breakpoints: Array<Breakpoint> | null;- css: string;- }- | string;-};+export type Project =+ | {+ pages: {+ [string]: {+ page: Page;+ tree: BaseInstance;+ props: Array<UserProp> | [];+ breakpoints: Array<Breakpoint> | null;+ css: string;+ };+ };+ }+ | Error;diff --git a/packages/http-client/src/index.test.ts b/packages/http-client/src/index.test.tsindex cb372d45fa..bdf0120436 100644--- a/packages/http-client/src/index.test.ts+++ b/packages/http-client/src/index.test.ts@@ -13,6 +13,9 @@ describe("getProjectDetails", () => {apiUrl,projectId: morePagesProjectId,});+ if (response instanceof Error) {+ throw response;+ }expect(Object.keys(response.pages).length > 1).toBeTruthy();});test("does not include pages", async () => {@@ -20,6 +23,9 @@ describe("getProjectDetails", () => {apiUrl,projectId: onlyHomeProjectId,});+ if (response instanceof Error) {+ throw response;+ }expect(Object.keys(response.pages).length === 1).toBeTruthy();});test("loads existing project", async () => {diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.tsindex 21ae3a2fa2..2c497122f3 100644--- a/packages/http-client/src/index.ts+++ b/packages/http-client/src/index.ts@@ -7,7 +7,7 @@ export const loadProject = async ({}: {apiUrl: string;projectId: string;-}): Promise<Project | string> => {+}): Promise<Project> => {try {if (apiUrl === undefined) {throw new Error("Webstudio API URL is required.");@@ -24,6 +24,6 @@ export const loadProject = async ({if (error instanceof Error) {return error;}- return "Unknown error";+ return new Error("Unknown error");}};