tristinDLC
tristinDLC
DDeno
Created by w7a9q on 11/20/2024 in #help
Converting package.json into deno.json
2 replies
DDeno
Created by Hasan Rimawi on 11/19/2024 in #help
How to resolve this?
You should be using these commands to use vite with deno:
deno run -A npm:create-vite@latest
cd my-vite-app
deno install
deno task dev
deno run -A npm:create-vite@latest
cd my-vite-app
deno install
deno task dev
3 replies
ZZod
Created by Haddok on 11/10/2024 in #questions
Haddok - hi , i have defined a schema where i a...
Are you trying to do something like:
import { z } from 'zod'

const object = z.object({
test: z.string(),
})

console.log(object.shape.test.safeParse('Fizz Buzz'))
import { z } from 'zod'

const object = z.object({
test: z.string(),
})

console.log(object.shape.test.safeParse('Fizz Buzz'))
4 replies
ZZod
Created by savage unreal on 8/27/2024 in #questions
unreal - Hello, i have this schema tsconst som...
@Scott Trinh Wow, I misread OP. I missed the curly braces originally and understood the problem to be that only null was being sent. That's my mistake. Looks like I need a nap haha
9 replies
ZZod
Created by savage unreal on 8/27/2024 in #questions
unreal - Hello, i have this schema tsconst som...
The issue is that the .nullable() and .optional() methods are being applied to the value associated with the "description" key only. The original z.object() that's wrapping your keys is still required to be provided to properly validate. Here is the code that works based on your schema above:
import { z } from 'zod'

const someSchema = z.object({
description: z
.string()
.min(20, 'Min description length is 20')
.max(50, 'Max description length is 50')
.nullable()
.optional(),
})

someSchema.parse({ description: null }) // { description: null }
import { z } from 'zod'

const someSchema = z.object({
description: z
.string()
.min(20, 'Min description length is 20')
.max(50, 'Max description length is 50')
.nullable()
.optional(),
})

someSchema.parse({ description: null }) // { description: null }
9 replies