elysiajs / elysia

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

Elysia should auto generate types like SvelteKit #608

Closed TechGunners closed 3 months ago

TechGunners commented 3 months ago

I'm pretty bad at writing feature requests, so I asked Gemini to do it for me

Current Functionality:

Elysia's Eden client provides excellent end-to-end type safety with TypeScript by leveraging type inference instead of code generation. While this approach offers a lightweight solution, it can involve more manual type definition compared to frameworks like SvelteKit.

Desired Functionality:

We propose a new feature that enables auto-generation of types for Eden, similar to how SvelteKit generates types from API routes. This would significantly improve the developer experience by:

Implementation Options:

Benefits:

Improved developer experience: Reduced boilerplate and automatic type generation will streamline development. Enhanced type safety: Auto-generated types will strengthen type safety and prevent potential runtime errors. Increased productivity: Developers can focus on application logic rather than manual type definitions. Alignment with Elysia's Goals:

This feature aligns with Elysia's focus on developer experience and end-to-end type safety. Auto-generated types will streamline development, promote type safety, and solidify Elysia's position as a developer-friendly framework.

Conclusion:

We believe that auto-generation of types for Eden will be a valuable addition to the Elysia framework. It will significantly improve developer experience, enhance type safety, and further differentiate Elysia from other frameworks.