elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.23k stars 198 forks source link

Fix #635 - Use StaticDecode<> instead of Static<> to get type of inpu… #636

Closed mnpenner closed 2 months ago

mnpenner commented 2 months ago

…t schema

This will infer the correct type with Typebox Transform Types (https://github.com/sinclairzx81/typebox?tab=readme-ov-file#transform-types) are used

david-plugge commented 2 months ago

@SaltyAom do you consider this for the next release? This is pretty useful. Like transforming a string to a date, converting using an enum and so on. I wonder if this is actually just a type issue or if this needs more work (actually transforming the data using typebox).

mnpenner commented 2 months ago

I wonder if this is actually just a type issue or if this needs more work (actually transforming the data using typebox).

I didn't hunt down where the deserialization happens, but as long as Elysia is using Decode it should automagically work, and indeed that seems to be the case in my little project.