elysia
elysia copied to clipboard
Query and headers type inference for eden
What is the problem this feature would solve?
Is query and header type inference for eden planned?
This will help to track if query and headers, mostly query, are changed and protect code which use API (for example frontend or tests) from missing it.
What is the feature you are proposing to solve the problem?
Infer types of query and headers for eden. It will help to track, reuse and extend type on tests and frontend.
What alternatives have you considered?
Export schema, instead infer type from eden.
Does not infer them for me too.
I see that Elysia instance properly stores it in ~Routes property type. So it's either problem with unpacking them in Treaty.Create. Or mismatch in Elysia/Eden version in node_modules
[email protected] @elysiajs/[email protected]
Also please intersect inferred headers type with Record<string, unknown> (or any other HeaderInit-ish type that you support) so it's possible to pass arbitrary additional headers to request