Type inference of query
params is wrong when Transforms are used
#635
Labels
bug
Something isn't working
query
params is wrong when Transforms are used
#635
What version of Elysia.JS is running?
elysia@1.0.18
What platform is your computer?
Linux 4.4.0-19041-Microsoft x86_64 x86_64
What steps can reproduce the bug?
Create a type transform like:
Then type your route:
What is the expected behavior?
query.afterCursor
should have the type of the return value ofdecodeToken
What do you see instead?
query.afterCursor
is typed asstring
(the input type coming from the client)Additional information
I haven't looked at Elysia's source code yet, but I'm guessing Elysia us using
Static
to infer the type whenStaticDecode
should be used instead: https://github.com/sinclairzx81/typebox?tab=readme-ov-file#transform-typesThere's another example of transforms on that page that's perhaps better than mine.
Edit: I think this line is the culprit:
elysia/src/types.ts
Line 205 in 968650b
The text was updated successfully, but these errors were encountered: