I have a set of classes and interfaces.
Folder structure
-Myutilityservice --classes ---SankeyUtilService.ts
This .ts file has a class
ex
You can expose project as an npm package by following these steps:
1) Create index.ts that will export all required classes:
export * from "./lib/Helper";
export * from "./lib/Log";
// ....
export * from "./lib/Query";
2) Make shure you transpile ts file with declarations
flag enabled - so you will get nice d.ts file alongside.
3) In your package.json specify transpiled index.js and index.d.ts like in the example below:
"main": "dist/index.js",
"typings": "typings/index.d.ts",
4) Publish your transpiled sources with definitions to NPM.
After these steps you will be able to access your package like this:
import * as MyLib from 'MyLib';
let h = new MyLib.Helper();
As an example - you can check a project here.