Problem with ez.dateOut()
in workspace environment
#2024
-
I have a file containing: export const productPriceSchema = z
.object({
price: z.number(),
date: ez.dateOut(),
}) I have the following endpoint importing the schema: export const getProductPricesEndpoint = routeFactory
.addMiddleware(authMiddleware(Permission.Read, Modules.Product))
.build({
method: "get",
tag: "product",
description: "Get all the product prices.",
input: emptySchema,
output: z.object({ items: z.array(productPriceSchema) }),
handler: async () => {
const items = await getProductPrices();
return { items };
},
}); I get the following error:
If I inline the schema instead of importing it, it works fine. I don't think this is related, but the import is done from another package (I have a monorepo structure). I already had this issue before, and it disappeared I don't know why. I tried with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
What are the versions of
|
Beta Was this translation helpful? Give feedback.
-
@RobinTail So this had nothing to do with I had indeed 2 versions of typescript between my
I fixed it by removing the typescript dependency from both projects and using a global dependency at my monorepo root. |
Beta Was this translation helpful? Give feedback.
@RobinTail So this had nothing to do with
bun
.I had indeed 2 versions of typescript between my
back
and mypackages/shared
workspace. This was causingexpress-zod-api
to be bundled twice at 2 different locations bypnpm
. I don't know exactly how, but this broke something inexpress-zod-api
.