diff --git a/packages/hoppscotch-data/src/collection/v/1.ts b/packages/hoppscotch-data/src/collection/v/1.ts index ae2de46e3..9ea6734b3 100644 --- a/packages/hoppscotch-data/src/collection/v/1.ts +++ b/packages/hoppscotch-data/src/collection/v/1.ts @@ -18,12 +18,15 @@ const baseCollectionSchema = z.object({ ), }) -type Collection = z.infer & { - folders: Collection[] +type Input = z.input & { + folders: Input[] } -//@ts-expect-error ~ Recursive type -export const V1_SCHEMA: z.ZodType = baseCollectionSchema.extend({ +type Output = z.output & { + folders: Output[] +} + +export const V1_SCHEMA: z.ZodType = baseCollectionSchema.extend({ folders: z.lazy(() => z.array(V1_SCHEMA)), }) diff --git a/packages/hoppscotch-data/src/collection/v/2.ts b/packages/hoppscotch-data/src/collection/v/2.ts index 22ad929ed..0702928b8 100644 --- a/packages/hoppscotch-data/src/collection/v/2.ts +++ b/packages/hoppscotch-data/src/collection/v/2.ts @@ -23,12 +23,15 @@ const baseCollectionSchema = z.object({ headers: z.union([HoppRESTHeaders, z.array(GQLHeader)]), }) -type Collection = z.infer & { - folders: Collection[] +type Input = z.input & { + folders: Input[] } -// @ts-expect-error ~ Recursive type -export const V2_SCHEMA: z.ZodType = baseCollectionSchema.extend({ +type Output = z.output & { + folders: Output[] +} + +export const V2_SCHEMA: z.ZodType = baseCollectionSchema.extend({ folders: z.lazy(() => z.array(V2_SCHEMA)), }) diff --git a/packages/hoppscotch-data/tsconfig.decl.json b/packages/hoppscotch-data/tsconfig.decl.json index 347c516eb..26e4dc796 100644 --- a/packages/hoppscotch-data/tsconfig.decl.json +++ b/packages/hoppscotch-data/tsconfig.decl.json @@ -13,5 +13,5 @@ "emitDeclarationOnly": true, "declarationDir": "./dist" }, - "include": ["src/*.ts"] + "include": ["src/**/*.ts"] } diff --git a/packages/hoppscotch-data/tsconfig.json b/packages/hoppscotch-data/tsconfig.json index a78aa1850..a87ab5942 100644 --- a/packages/hoppscotch-data/tsconfig.json +++ b/packages/hoppscotch-data/tsconfig.json @@ -10,5 +10,5 @@ "skipLibCheck": true, "resolveJsonModule": true }, - "include": ["src/*.ts"] + "include": ["src/**/*.ts"] }