After update from 1.0.27 to 1.1.1, in my project TSC complains about some route handlers not having a type for body. The strange part is, some routes is ok (even for routes of same file), TSC do not complain and my IDE shows the correct type of it, but others not.
There is an example of code that reproduces the current behavior:
index.ts
const PORT = Bun.env.PORT ?? 3000
const app = new Elysia()
.use(coreHandlers)
.listen(PORT)
core.ts
export const coreHandlers = new Elysia()
.guard({
beforeHandle: ({ set, headers }) => {
// this works, `set` and `headers` has the correct types
},
})
.use(eventModel)
.post(
"/r",
async ({ body, headers }) => {
// these types also works
},
{
body: "input",
response: "output",
}
)
.post("/i", async ({ body }) => {
// this does not work, it complains about `body` being any
}, {
body: "onlyIds",
response: t.Any(),
})
What version of Elysia.JS is running?
1.1.1
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
After update from 1.0.27 to 1.1.1, in my project TSC complains about some route handlers not having a type for
body
. The strange part is, some routes is ok (even for routes of same file), TSC do not complain and my IDE shows the correct type of it, but others not.There is an example of code that reproduces the current behavior:
index.ts
core.ts
event.ts
What is the expected behavior?
This code should work and compiler should not complain about any issue.
What do you see instead?
Additional information
Bun v1.1.19