This is probably not the best question but I'm still completely new to JS. I'm interested in Typescript (being an AS3 dev), but I keep reading that I need to instal node.js to compile it? why is that?
这可能不是最好的问题,但我对JS还是完全陌生的。我对打字稿(AS3 dev)很感兴趣,但我一直在阅读需要安装node的文章。js编译吗?这是为什么呢?
1 个解决方案
#1
4
TypeScript is a language that compiles into JavaScript. The compiler that does this, appears to be written (or at least distributed) in JavaScript. And node.js is the most common way to execute JavaScript outside a browser.
TypeScript是一种编译成JavaScript的语言。这样做的编译器似乎是用JavaScript编写的(或至少是分布式的)。和节点。js是在浏览器之外执行JavaScript的最常用方法。
The typescript compiler is simply JavaScript, which is executed by node.js to compile things.
typescript编译器只是JavaScript,由node执行。js编译的事情。
Why is that, you ask? Well, because that's what the developers of the compile chose to write their compiler in. It could have been any language they wanted really.
你会问,这是为什么?因为这就是编译器的开发人员选择编写编译器的原因。这可能是他们想要的任何语言。
My hunch though, is that the compiler is actually written in TypeScript, and they distribute the compiled version. Yeah, a compiler written in the language it's supposed to compile, weird but possible, and beyond the scope of this question.
我的直觉是,编译器实际上是用打字稿编写的,它们分发编译后的版本。是的,用它应该编译的语言编写的编译器,奇怪但可能,超出了这个问题的范围。
#1
4
TypeScript is a language that compiles into JavaScript. The compiler that does this, appears to be written (or at least distributed) in JavaScript. And node.js is the most common way to execute JavaScript outside a browser.
TypeScript是一种编译成JavaScript的语言。这样做的编译器似乎是用JavaScript编写的(或至少是分布式的)。和节点。js是在浏览器之外执行JavaScript的最常用方法。
The typescript compiler is simply JavaScript, which is executed by node.js to compile things.
typescript编译器只是JavaScript,由node执行。js编译的事情。
Why is that, you ask? Well, because that's what the developers of the compile chose to write their compiler in. It could have been any language they wanted really.
你会问,这是为什么?因为这就是编译器的开发人员选择编写编译器的原因。这可能是他们想要的任何语言。
My hunch though, is that the compiler is actually written in TypeScript, and they distribute the compiled version. Yeah, a compiler written in the language it's supposed to compile, weird but possible, and beyond the scope of this question.
我的直觉是,编译器实际上是用打字稿编写的,它们分发编译后的版本。是的,用它应该编译的语言编写的编译器,奇怪但可能,超出了这个问题的范围。