I am dealing with various files containing namespaces and classes structured as follows:
1) namespace.js:
var mynamespace = window.mynamespace || {};
2) class1.js:
mynamespace.class1= (function() {
var _public = {};
_public.someBoolean= false;
return _public;
})();
3) class2.js:
mynamespace.class2= (function() {
var _public = {};
_public.init= function() {
};
return _public;
})();
My goal is to bundle them together and make them accessible through a library. The structure I have in mind is something like the following:
expose default {
mynamespace
};
This way, I can use it in a different project by importing it as shown below:
import * as mynamespace from 'mynamespace';
var a = function() {
mynamespace.class1.someBoolean = true;
ansomenamespace.class2.init();
};
Can you guide me on how to achieve this? Also, I would like to expose its type definitions for TypeScript usage. Thank you!