Elysia/Eden Type Inference Issue: Response Inferred as any
#1505
Unanswered
amir-reza-bijandi
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Hi 👋 seems more like a tsconfig or ts export problem to me. I'm not a TS expert but one solution could be generating .d.ts files and expose them in your package.json Also, be careful, as the Anime is a class with methods that you cannot call on the client side (even if the type says so). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I just recently started using Elysia, and I've encountered a problem that I can't wrap my head around! In the example below, when I try to use Eden, the response type is inferred as
any(animeListanddatavariables):[mal/index.ts]:
[add-anime-modal.svelte]:
The Fix
I was stuck on this issue for a while, and I was trying to figure out what I did wrong, but all I had to do was to make the following change (explicitly casting the return value):
Seeking Explanation
Is there an explanation for this behavior? Why was the return type not automatically inferred from the
await Mal.search(query)result, and why was the explicitas Anime[]cast necessary for Eden to correctly infer the type?This is the GitHub repository if you want to play around with the code: https://github.com/amir-reza-bijandi/anime
Beta Was this translation helpful? Give feedback.
All reactions