-
-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.4
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What environment are you using
1.2.21
Are you using dynamic mode?
no
What steps can reproduce the bug?
Types not working on Cookies
import { Elysia } from 'elysia';
import { z } from 'zod';
new Elysia()
.get('test', ({ cookie: { test } }) => test, {
cookie: z.object({ test: z.string() }),
})Types not working on Query
import { Elysia } from 'elysia';
import { z } from 'zod';
new Elysia()
.get('test', ({ cookie: { test } }) => test, {
cookie: z.object({ test: z.string() }),
})What is the expected behavior?
Cookie
Equivalent TypeBox Code:
import { Elysia, t } from 'elysia';
new Elysia()
.get('test', ({ cookie: { test } }) => test, {
cookie: t.Object({ test: t.String() }),
})Query
Equivalent TypeBox Code:
import { Elysia, t } from 'elysia';
new Elysia()
.get('test', ({ query }) => ({ query }), {
query: t.Object({ num: t.Numeric() }),
});What do you see instead?
Cookie
Query
Cannot reproduce, but it does not work on one of my nested routes. I do not actually get any error, but instead all validation and coercing in query simply does not work. It just gives you plain string or undefined. Like the following:
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
yes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working


{ "a": "1234", // yes, even after `z.coerce.number()`. "b": "true", // yes, i did `z.stringbool()` here. }