Currently, I am working with Next.js and TypeScript, setting up path aliases in my project without any issues. However, I'm facing a small difficulty when it comes to dealing with index.ts
files within folders. My goal is to achieve something similar to the code below:
// interfaces/index.ts
export type { IProfile }
// page/index.tsx
import { IProfile } from '@/interfaces';
When I try this approach, an error pops up:
The module '@interfaces;' or its corresponding type declarations cannot be found.
Of course, the quick fix is to import using @/interfaces/index
, but I prefer to avoid that route. Is there any other solution available for this issue?