Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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.

share|improve this question
    
You could refer this answer, Either just call a js function directly(you may see warning) or make it declare variable – Pankaj Parkar yesterday
    
Why don't you write your code in TypeScript too? I recommend it. – Tamas Hegedus yesterday
    
Actully i am calling my js function from Android activity, thats why i wanted to call the typescript methoda from this js method. – Ashish Maurya yesterday

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.