elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.1k stars 193 forks source link

Eden Treaty ignores t.Transform() #662

Open Guibi1 opened 1 month ago

Guibi1 commented 1 month ago

What version of Elysia.JS is running?

1.0.22

What platform is your computer?

No response

What steps can reproduce the bug?

Create any endpoint with body validation using a t.Transform:

// Server
const app = new Elysia().post(
    "/",
    ({ body }) => {
        // Here value has the type `string`, which is GOOD
        console.log(body);
    },
    {
        body: t.Object({
            value: numToStr,
        }),
    },
);

// Client
treaty<App>("_url_").index.post({ value: 2023 }); // Here the value has the type `string`, which is BAD

What is the expected behavior?

The Treaty should asks for a number.

What do you see instead?

The Treaty asks for a string.

Additional information

No response