Track and save on groceries

fix(api): fix pagination type inference

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>

+6 -13
+2 -6
packages/api/package.json
··· 2 2 "name": "@cherries-app/api", 3 3 "version": "1.0.0", 4 4 "type": "module", 5 - "description": "", 6 - "main": "index.js", 7 5 "scripts": { 8 6 "build": "tsc", 9 7 "dev": "tsc --preserveWatchOutput --watch", 10 8 "generate": "pnpm build && node dist/spec.js" 11 9 }, 12 - "keywords": [], 13 - "author": "", 14 10 "license": "ISC", 15 11 "packageManager": "pnpm@10.28.0", 16 12 "dependencies": { ··· 25 21 }, 26 22 "exports": { 27 23 ".": { 28 - "types": "./src", 29 - "default": "./dist" 24 + "types": "./src/index.ts", 25 + "default": "./dist/index.js" 30 26 }, 31 27 "./contract": { 32 28 "types": "./src/contract/index.ts",
+2 -2
packages/api/src/schema/pagination.ts
··· 4 4 export const Total = z.coerce.number().int().min(0); 5 5 export const Limit = z.coerce.number().int().min(0); 6 6 7 - export const pageOptions = (cursor: z.ZodType) => 7 + export const pageOptions = <T extends z.ZodTypeAny>(cursor: T) => 8 8 z.object({ 9 9 limit: Limit.default(DEFAULT_LIMIT), 10 10 cursor: cursor.optional(), 11 11 }); 12 12 13 - export const paginated = (item: z.ZodType) => 13 + export const paginated = <T extends z.ZodTypeAny>(item: T) => 14 14 z.object({ 15 15 total: Total, 16 16 limit: Limit,
+2 -5
packages/db/package.json
··· 3 3 "version": "1.0.0", 4 4 "type": "module", 5 5 "description": "", 6 - "main": "index.js", 7 6 "scripts": { 8 7 "build": "tsc", 9 8 "dev": "tsc --preserveWatchOutput --watch", ··· 12 11 "push": "drizzle-kit push", 13 12 "seed": "pnpm build && node dist/seed.js" 14 13 }, 15 - "keywords": [], 16 - "author": "", 17 14 "license": "ISC", 18 15 "packageManager": "pnpm@10.28.0", 19 16 "dependencies": { ··· 31 28 }, 32 29 "exports": { 33 30 ".": { 34 - "types": "./src", 35 - "default": "./dist" 31 + "types": "./src/index.ts", 32 + "default": "./dist/index.js" 36 33 } 37 34 } 38 35 }