I have developed an npm library that is made up of several ES6 modules, which are then consolidated into a single js file. The directory structure looks like this:
src
main.ts
one.ts
two.ts
three.ts
types
index.d.ts
index.ts
The index.ts file imports main.ts and exports it as the entry point for the library.
When I bundle the files, d.ts files are automatically generated for each module and placed nearby like so:
two.ts
two.d.ts
I've noticed in other libraries that there is only one index.d.ts file for the library entry point. How can I make sure declaration files are generated only for the entry point and not for individual ES6 modules?
Additionally, I store all my interfaces in a separate file and import them when needed. For example:
import { someInterface } from './types'
const something: someInterface
However, these imports show up in autogenerated d.ts files like this:
import { someInterface } from './types';
declare class someClass {
someVar: string;
}
I would prefer the someInterface to be included directly as text, rather than as an import statement.
Am I approaching this situation incorrectly?