Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseUrl causes the typescript compiler to lose track of types and replace the edenTreaty client with any #42

Closed
m1212e opened this issue Jan 7, 2024 · 1 comment

Comments

@m1212e
Copy link

m1212e commented Jan 7, 2024

Hi,

I just wanted to raise awareness about this since it took a lot of time for me to figure this out, maybe this will help someone save some time in the future:

I use eden and elysia to provide a typesafe way to access my api. Since I'm writing an API which is intended to be used across many projects, I decided to provide a library/sdk to access it. This library provides some init code and exports an edenTreaty api client to access the actual api. After building my library the output .d.ts files did not contain the correct types. TS replaced the return type of the edenTreaty call with an "any" type. It took me a very long time to figure out, why this was happening:

I used the "baseUrl" property in my tsconfig.json (the one in the API package, not the client) to simplify imports. After replacing that with relative imports, everything works as expected. I'm not really expecting the eden/elysia project to do something about this, so I'll instantly close this, but I wanted to create some record so people don't have to deal with the same issue as long as I did.

@Ripwords
Copy link

Ripwords commented Jul 6, 2024

#110 (comment)

I had the same issue but was due to alias, you can try this fix to see if it helps you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants