wobsoriano / elysia-autoroutes

File system routes for Elysia.js.
MIT License
109 stars 8 forks source link

Generate types for Eden #9

Open framp opened 11 months ago

framp commented 11 months ago

Thanks for the work on this module!

I have a suggestion on how to get types for Eden.

We're loading files async at runtime, which makes it impossible to have end to end type safety during development.

I think Prisma has a similar issue (just with database schemas, instead of async file fetching) and the only solution is to generate types manually from a state X of the filesystem

In order to have this working we need to configure something project wise, so that if you have multiple instances to elysia-autoroutes you could generate the type for all of those directories.

Ideally I'd like to have:

Runtime behaviour will be unchanged, we should just get better types instead of unknown

What do you think? I might try to sketch something

kravetsone commented 8 months ago

I released elysia-autoload with this feature)

NPM GitHub