Cannot find module 'docs.mdx' or its corresponding type declarations

Viewed 605

When I'm going to import a file with the extension .docs.mdx into a typescript file (.tsx) it gives this error:

Cannot find module 'docs.mdx' or its corresponding type declarations.

I tried to create in the root of my project and in the src folder, a folder called @types, and inside it I created an index.d.ts with the following code:

declare module '*.docs.mdx';

Did not work. So I changed the name from index.d.ts to mdx.d.ts and then to docs.mdx.d.ts and it still didn't work.

Finally, I tried to add this Type Declaration in the typeRoots that is in tsconfig.json, like this:

tsconfig.json

It didn't work either, the error remains.

Does anyone have any solutions, please?

1 Answers

in my case, the file i was editing was in the exclude list of tsconfig, which is odd

Related