I'm a bit wondering, why nobody else had this problem or maybe I just don't use the right words to describe it. The problem is, that I have a module that I publish to npm that has to versions. One can be loaded through system-js and use directly from npm, the other version is a selfexecuting bundle that I create with system-js-builder.
Let's asume the module is called @company/foo I have a index.ts in the root folder, that simply exports everything from src, where I also have an index.ts where all submodules are exported. So the index.ts looks like this.
export * from "./src/";
And in my modules I want to use it I can simply use the following.
import { bar } from "@company/foo";
So far so easy. No I create a self executing bundle from my index and give it the global name foo so I would be able to call foo.bar() if I add the script into a page or concatenate with others. This also works great. But now I have the problem, that I have no idea how to create typings for this bundle. My idea was to do something like
declare namespace foo {
export * from "./src/";
}
which I thought describes very well what the bundling does. But typescript doesn't like this. I also tried something with modules but nothing works. How can I describe the fact, that what is exported from my src barrel is prefixed with the namespace foo?
I hope it's clear what I want to achieve.