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

I have written some services for my ionic mobile app (which is in javascript - ecma6). Now i need to reuse that code in a web app which is written in typescript.

The idea which i had was, compiling es 6 script to es 5 and then use it inside typescript but in this approach i will loose angular's dependency injection and other features i guess.

So the question is, how can i reuse code written in javascript - ecma6 in typescript.

Any pointers to the right direction would help.

share|improve this question
1  
Maybe I'm missing something, but code written in valid ecma6 should be valid typescript. Wouldn't just changing the extension to .ts be enough? – cdbajorin Jun 7 at 19:42
    
@cdbajorin: not sure about that because typescript supports type hinting which in ecma 6 is achieved by creating a static get method called parameters. something like static get parameters() {return [[Controller]]; } – Cerlin Boss Jun 8 at 5:09

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.