Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found TypeError: Cannot create property on string #670

Open
novikovfred opened this issue Jun 7, 2024 · 1 comment · May be fixed by #671
Open

Found TypeError: Cannot create property on string #670

novikovfred opened this issue Jun 7, 2024 · 1 comment · May be fixed by #671

Comments

@novikovfred
Copy link

novikovfred commented Jun 7, 2024

Describe the bug and the expected behavior

If we first pass an immutable object in the url parameters and then try to add a property to it, we get the TypeError: Cannot create property on string. I expect that the library will not return an error and will give the first values it finds when unpacking.

Conform version

v1.1.4

Steps to Reproduce the Bug or Issue

import { parseWithZod } from '@conform-to/zod'
import { z } from 'zod'

const someSchema = z.object({
 someNumber: z.number().min(1).optional(),
 someString: z.string().min(1).optional(),
})

const url = new URL('http://localhost/smth?c=name&c.A=somea')
const parsed = parseWithZod(url.searchParams, {
    schema: someSchema,
})

console.log(parsed)
@novikovfred
Copy link
Author

#671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant