我喜欢在我的代码中的某个地方有一个函数,它将一个打字符字符串作为参数,并在返回时输出javascript字符串。我正在考虑将Tsc编译器连接到ClearScript提供的V8上,但是这个东西没有很好的记录,我想我正在寻找一个nuget包形式的快捷方式。有什么建议吗?
答案 0 :(得分:1)
typescript编译器只是一个命令行可执行文件tsc.exe。您可以通过执行以下操作来完成此操作:
// write text to temporary .ts file ...
var startInfo = new ProcessStartInfo {;
FileName = "\path\to\tsc.exe",
Arguments = args // parameters to pass to tsc, including .ts
};
Process.Start(startInfo);
// read text from newly created .js file