restyped-express-async
restyped-express-async copied to clipboard
type conversion
Hi,
I am doing some small tests using restyped. I noticed that params and query can be typed with different types than strings. In a handler both query and params will be strings at runtime. The problem is, that according to the API definition they are number for instance. Is this intended behaviour?
Thanks, Thomas
Hi there, thanks for the issue. You are right, the query and params implementation should force types to be strings on the server side. Although we still want to allow them to be other types like numbers and booleans on the client, they will always come through as strings in req.query
and req.params
in express route handlers. Therefore, this change would apply to this package only and not the RESTyped spec itself.
I'll make a note to update the typings in this package in the next release.
Did you finish this @rawrmaan ?