Clear wasp api endpoint imports errors in ide?
Is there a way to fix these annoying things?
VSCode errors every wasp api endpoint in the imports.
13 Replies
Hi @randopixel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Wohooo @randopixel, you just became a Waspeteer level 2!
----------------------
Yes, there are ongoing discussions and efforts to improve IDE support for Wasp, including handling of imports.
One of the issues discussed is the IDE not recognizing certain imports, especially those starting with
@wasp
. This is due to the special way Wasp handles these imports, which are not standard Node.js imports.
A potential solution discussed in the community is to generate an npm package with Wasp's runtime and types, similar to what Prisma does. This would make it easier for the IDE to recognize and handle these imports (source (https://github.com/wasp-lang/wasp/issues/570)).
Another suggestion is to improve the structure of Wasp SDK imports, which could make them more intuitive and easier to handle for both developers and IDEs (source (https://github.com/wasp-lang/wasp/issues/1657)).
However, these are still under discussion and not yet implemented. For now, you might have to tolerate these IDE errors, as they should not affect the actual running of your Wasp application.
For more information and updates, you can follow the relevant discussions on the Wasp Github page.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @randopixel, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@randopixel i didn't quite get what the issue is. Can you explain it in more detail + share the screenshot?
anything that refers to a wasp endpoint, like:
You mean any wasp import? That means your project is not set up as it should be. Have you tried doing
wasp clean
? Does wasp start
run for you ok? Any errors in it?Everything works as expected. All of the endpoints are valid on use. the operations all get aggregated and useable at compile. No errors except for what you see
@martinsos
Do other Typescript projects work for you in VS Code? Did you try restarting the Typescript Language server? Which Wasp version are you using?
Yes, Yes and 0.14.2
@sodic could you jump in, I'm not sure what to debug next
What's the error reported by the IDE?
Cannot find module 'wasp/client/operations' or its corresponding type declarations.ts(2307)
same for all wasp endpoints.
It does not affect operation. Everything works as expected.
So it's definitely an IDE issue.
We had a user with a similar problem, can you try this (I'm guessing you're on Windows): https://discord.com/channels/686873244791210014/1277574894107754506/1282744707654352948