I am currently in the process of creating a new npm package. I have two TypeScript files, each containing namespaces and modules with the same name 'X'. At the end of each file, I declared the following:
export default X;
My goal is to import both of them into the index.d.ts
file and then export them so that outer files (files that import this repository/package) can import and utilize the modules and namespaces of X
.
However, when I try to import them both like this:
import X from "./file1"
import X from "./file2"
I encounter the following error:
Duplicate identifier 'X'
Is there a way to have the same namespace in two different TypeScript files and export them to outer packages successfully?