Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  169] [ 1]  / answers: 1 / hits: 157971  / 12 Years ago, mon, october 1, 2012, 12:00:00

I'm wondering how is it possible to transform the TypeScript into JavaScript in a cross platform manner. I'm aware about availability of node package manager for typescript, but are there any other alternatives which can be used on the server side?


More From » typescript

 Answers
13

Short version: use Node if you can. It's becoming unavoidable nowadays.



Maybe it's not the answer you want, but as everybody mentioned, the compiler is a JS file, so, your options are the options of executing a JS file.



In Windows, there are 2 obvious ones, Node, and Windows Script Host.



You know about node already, the other option is a component that comes with all versions of Windows (I think), you can do it like this:



cscript path/to/tsc.js source-file.ts


You can see all compiler options by just:



cscript path/to/tsc.js


On Linux I assume you should be able to use (in addition to node):




  • V8 standalone shell, replace node or cscript with v8-shell

  • ExecJS https://github.com/sstephenson/execjs

  • Any other JS runner available on the selected platform (another answer mentioned Rhino for example)



Update: Another answer suggests the compiler API is only compatible with node and Windows Script Host (cscript tool), so, if correct, then on Linux you'll need Node to compile TypeScript.



If you are looking for something like apt get tsc (or whatever the Linux/Mac package managers are like), I think there isn't.



I remember reading somewhere that the I/O is optimized for Node and Windows Script Host, so, if you have problems with options, you'll probably end up with Node if seeking platform independence.



Update: Another answer here confirms the same about compatibility.


[#82813] Saturday, September 29, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jennie

Total Points: 593
Total Questions: 102
Total Answers: 106

Location: Federated States of Micronesia
Member since Fri, Sep 16, 2022
2 Years ago
jennie questions
;