Craig
Craig

Reputation: 1796

How do you add a typescript namespace from a node module to the global namespace?

I know that this is not best practice but I dont have a choice. The project I am working on has had its own moment typings file for a long time and it is now causing issues. Moment now provides its own typing file which I want to use, but I need to keep it global. How do I do this please?

I have tried just editing our moment.d.ts file inline with suggestions here [TypeScript: How can I make an existing namespace global? which didnt work with an error of 'moment refers to a UMD global, but the current file is a module'.

I have also tried editing the typescript config file to simply 'include' the the node module d.ts file but this gave me a no inputs were found in config file error.

Upvotes: 1

Views: 144

Answers (1)

Craig
Craig

Reputation: 1796

Solved this by creating a new global custom typing and a global value cosponsoring which is a separate moment instance. Super hacky and very temporary but works for now...

Upvotes: 1

Related Questions