elysiajs / elysia

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

Eden Treat types break when using absolute import paths #650

Closed dominictobias closed 1 month ago

dominictobias commented 1 month ago

What version of Elysia.JS is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

Import t types for route handler response from absolute paths e.g. src/types/articleResponse instead of ./types/articleResponse

Making use of baseUrl: '.' in tsconfig.json

Same issue occurs with "@src/*": ["./src/*"], path re-write.

What is the expected behavior?

Eden Treaty should pick up the response type of the route

What do you see instead?

Type becomes TreatyResponse<{ 200: any[]; }> | undefined or sometimes TreatyResponse<any> | undefined

Additional information

This was an odd one. If anyone gets confused why their types stopped working for eden treat v2 at least while splitting things out into separate files, then change your imports to be relative (including if the file with the t type definitions imports other types).