I am trying to publish a typescript library. It is not clear to me how to expose all the types and interfaces. Here is my setup:
mylib
├──src
│ ├──types
I recently faced the same problem and the only way I found in order to publish your Type-Space code (e.g.: types, interfaces) together with your Value-Space code (e.g.: function, classes, variables) is to export a namespace
that contains everything.
Another odd thing is that in order to export into a namespace
something imported, the syntax is:
import * as mymod from './mymod';
import * as mytypes from './mytypes';
export namespace mylib {
export import mod = mymod;
export import types = mytypes;
}
With the export import
syntax.
Unfortunately this in my eslinter will resolve in a warning/error since apparently it reads mod
and types
as unused-vars
.
I don't understand why there is no a full explanation for this topic in the documentation.