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
Since 1.2.7 response type in mapResponse was changed to unknown and now is not aligned with the way runtime works.
new Elysia().mapResponse(({ response }) => response); works perfectly in runtime but gives an error on a type level (see test/lifecycle/map-response.test.ts:266). Apparently, it now forces you to handle unknown type and convert it manually to Response which is not really convenient and requires you to do stuff like JSON.stringify on your own.
I think the runtime behavior makes more sense and it should be allowed to return any type (taking into account the response schema if provided) as you already can do in the handler itself (you can still choose to return Response explicitly if you want to though).
What is the expected behavior?
mapResponse return type should be aligned with runtime behavior.
What do you see instead?
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
No response
The text was updated successfully, but these errors were encountered:
What version of Elysia is running?
1.2.9
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Since 1.2.7
response
type inmapResponse
was changed tounknown
and now is not aligned with the way runtime works.new Elysia().mapResponse(({ response }) => response);
works perfectly in runtime but gives an error on a type level (seetest/lifecycle/map-response.test.ts:266
). Apparently, it now forces you to handleunknown
type and convert it manually toResponse
which is not really convenient and requires you to do stuff likeJSON.stringify
on your own.I think the runtime behavior makes more sense and it should be allowed to return any type (taking into account the response schema if provided) as you already can do in the handler itself (you can still choose to return
Response
explicitly if you want to though).What is the expected behavior?
mapResponse
return type should be aligned with runtime behavior.What do you see instead?
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?No response
The text was updated successfully, but these errors were encountered: