You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
exportconstcoreHandlers=newElysia().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(),})
event.ts
constidsModel=t.Object({// ...},{additionalProperties: true})exportconsteventModel=newElysia().model({onlyIds: t.Object({ids: idsModel,},{additionalProperties: true}),input: t.Object({// some code goes here...},{additionalProperties: true}),output: t.Object({// some code goes here...},{additionalProperties: true}),})
What is the expected behavior?
This code should work and compiler should not complain about any issue.
What do you see instead?
❯ bun tsc --noEmit
src/handlers/core.ts:140:14 - error TS7031: Binding element 'body' implicitly has an 'any' type.
140 async ({ body, store }) => {
~~~~
error: "tsc" exited with code 2
Additional information
Bun v1.1.19
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: