I am facing an issue with importing types from a .d.ts file that I created. The TypeScript compiler is giving an error related to the file path, displaying this message:
File '.../lib/types/generated.d.ts' is not a module.ts(2306)
The error occurs at the beginning of a .ts file where I am trying to import the type:
import type { CategoryForm } from '../../lib/types/generated';
This file includes the following content:
...
declare namespace App.DTO.Category {
export type CategoryData = {
id: string;
parent_id: string | null;
name: string;
slug: string;
category_type: App.Enums.CategoryType;
created_at: string;
updated_at: string;
};
export type CategoryForm = {
parent_id: string | null;
name: string;
category_type: App.Enums.CategoryType;
};
}
...
I have tried multiple ways to import the type without success. What could be the issue here?
I have attempted different approaches to importing the type but none seem to work. Any suggestions on how to resolve this would be appreciated.