在 Hacker News 上看到「Node.js adds experimental support for TypeScript (github.com/nodejs)」這個,標題有點誤導就是了,GitHub 上面的標題比較正確:「module: add --experimental-strip-types」。
從說明可以看到 --experimental-strip-types
參數只是接受 type 語法,但不會檢查:
It is possible to execute TypeScript files by setting the experimental flag --experimental-strip-types.
Node.js will transpile TypeScript source code into JavaScript source code.
During the transpilation process, no type checking is performed, and types are discarded.
目前的版本離跑 TypeScript 還有段距離,不過算是個有趣的開頭:
At least initially in this PR no trasformation is performed, meaning that using Enum, namespaces etc... will not be possible.
不確定官方打算要支援 TypeScript,還是只是個人作個實驗看看?