How to use Javascript module in typescript

54 Views Asked by At

I have a third-party Javascript module that is done in AMD way. I do not have typing file (type.d) for it nor I can create the typing file.

But I need to use the module in one of the typescript How can I do it.

Please note I have also a few javascript files which are using the third-party javascript module there I am using it this way

       require(["thirdPartyModule"], function(module){

             //this is just example code
             module.doSomething();

             //more code here
         }

How can I do the same thing in typescript asking it to load the Js module as a dependency. Also we since another Javascript is already loading the module hence we have the third party module loaded in DOM already through requireJs

Any help or pointer to read will highly be appricated

1

There are 1 best solutions below

0
Ankit Gupta On

i think you just need to import those JS files into your HTML and then you should be able to use them