#Cannot find module 'convex/types' or its corresponding type declarations.

3 messages · Page 1 of 1 (latest)

brisk terrace
#

Cannot find module 'convex/types' or its corresponding type declarations.

vital muskBOT
#

Hi @brisk terrace. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

It looks like you're encountering a TypeScript error related to missing type declarations for Convex. This is a common issue that can occur when working with TypeScript in a Convex project.

There are a few potential solutions to this problem:

  1. Make sure you're using a compatible TypeScript version. Convex requires TypeScript version 5.0.3 or newer as mentioned in the TypeScript documentation.

  2. Run code generation. Convex uses code generation to create types specific to your app. Try running:

    npx convex dev
    

    This will generate the necessary type definitions in the convex/_generated directory as documented here.

  3. Check your tsconfig.json. Some users have reported issues with the moduleResolution setting. Try setting compilerOptions.moduleResolution to "Bundler" in your convex/tsconfig.json as suggested in community discussions.

  4. Check for path mapping issues. If you're using custom path mappings in your tsconfig.json (like "paths": {"@/*": ["./*"]}), this might be causing conflicts with Convex's type resolution as reported by community members.

If you're still experiencing issues after trying these solutions, you might want to check if your project structure is correct or if there are any specific configurations in your setup that could be causing the problem.

Let me know if any of these solutions help or if you need further assistance!

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: