Skip to content

Schema option gives error on non TypeBox schemas (i.e. Zod) #117

@davidjortizrivera

Description

@davidjortizrivera

What version of Elysia is running?

1.4.15

What platform is your computer?

Darwin 25.1.0 arm64 arm

What steps can reproduce the bug?

Create a plugin that uses the jwt plugin and pass a zod schema to the options.

export const cookie = () => new Elysia({ name: Name.Cookie }).use(jwt({ secret: process.env.COOKIE_SECRET, schema: CookieVerify.schema }))

What is the expected behavior?

It would be nice to have the whole ecosystem accept other validation libraries like on the main Elysia instance.

What do you see instead?

Type 'ZodObject<{ id: ZodString; }, $strip>' is missing the following properties from type 'TSchema': params, static, [Kind]ts(2739)
index.d.ts(145, 5): The expected type comes from property 'schema' which is declared here on type 'JWTOption<"jwt", TSchema | undefined>'

Image

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions