Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question #18

Open
publicocean0 opened this issue Jul 24, 2017 · 1 comment
Open

question #18

publicocean0 opened this issue Jul 24, 2017 · 1 comment

Comments

@publicocean0
Copy link

publicocean0 commented Jul 24, 2017

is there a way for converting typescript to javascript programmatically(sync way?)

@sinclairzx81
Copy link
Owner

Hi,

Thanks for the query. I would strongly advise against using this project and i may be marking it as deprecated in future. Please, know, the compiler used in this project is typescript 0.9.0 (pre 1.0), with the most recent typescript compiler being typescript 2.4.2 (as of writing).

If you are looking to convert typescript into javascript programmatically, the current approaches i know of are listed below.

  • run the tsc compiler module as a child_process (async) with node. (recommended)
  • opening up the modern typescript compiler source and writing a new programmatic interface (which is what this project attempted way way back)

I has been a long time since i have looked at the compiler, but it may be more conducive to developing a programmatic interface than it had been. So its worth taking a look. (something i may do in future)

In terms of compiling sync, it may be possible, but not in this project. the reason is that this project supports resolving typescript modules over http, and fetching things over http is inherently async. But with this in mind, i do encourage you to consider async for your tasks as the compiler can halt other processing happening in your application.

I would perhaps also encourage you to explore what is available on npm outside this project, there may be other similar projects available today :)

Thanks
sinclair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants