I am writing a library package in Typescript to be published to the npm registry such that it can be used by various other projects.
I have followed the publishing doc to ensure that the --declaration option is true for tsc such that type definitions are exported as well in *.d.ts files.
The question I have is right now such exports are scattered in various folders and the consumers of my package are importing them like below.
import { FooType } from 'my-test-pacakge/dist/src/foo/types';
import { BarInterface } from 'my-test-package/dist/src/foo/bar';
I am wondering whether this is acceptable as it looks messy. Should I write my own declaration file to organize them in a cleaner manner?
There are existing answers to similar questions suggesting exporting the API through a general index.ts file. That sounds pretty legitimate to me but I am just wondering whether importing from the dist folder directly is considered bad practice?