import APIModule from ‘whatever/path/APIModule’
const apiModule = APIModule.getInstance()
What I did was instantiate APIModule in file
A directly and export it as a constant like this. Then import that constant in file
const apiModule = Object.freeze(APIModule.getInstance()); export default apiModule;
I figured that way I don’t need to write
APIModule.getInstance in every file where I use it.
As to TS in general … at the risk of getting into opinion territory … I think TS is the wave of the future. It has been shooting up in popularity and “fixes” some of the “problems” with JS. I think any smart JS developer needs to learn TS.
I enjoy TS and find it satisfying to learn. However, I have heard some hardcore JS old-timers saying it is terrible for JS. Those same people are also not in favour of inheritance in JS, but I like it as I find it very intuitive to write, read and understand and gives me good control over my code. Although, I am sure you can do the same thing without it. You mentioned e.g.
# which I read about recently somewhere.