Open JohnnyRacer opened 7 months ago
The same error occurs if I import { t } from 'elysia
.
Seems like the problem is t.Number()
, using t.Numeric()
fixes this issue.
While most people are comfortable with dealing with a flat, Record like object for handling their query parameters, I think that Eden Treaty and Eden Fetch should allow for serialization of objects into the query string using a tool like https://www.npmjs.com/package/qs I think support for this could be added by modifying Eden to have a lifecycle hook specifically for handling how the $query
object gets converted to a query string. Elysia might need a hook for the deserialization step for all incoming requests.
Hello I am trying to use query params in my routes but seems to have trouble with the number type. The following route when accessed via the URL gives this error : `Invalid query, \'num\' Expected : {} Found : { "num": "3" }'
The URL I am fetching from is : '/num?number=3`
However if I change the type to
{number : t.String()}
it works as expected.