简体   繁体   中英

Call typescript function in external javascript function

i have one typescript file with name 'abc.ts' having a method call 'ScanCode()'. i have one separate js file "sample.js" having a method foo(). i want to call the scancode method of typescript in this sample js' foo method.

I tried to import ts file in javascript but its not able to idetify 'import' function.

You have to compile the typescript file you have to javascript or if you want to import it use something like webpack. I think that the easiest way to call your typescript function is to make it global.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM