(注:開發工具 webstorm 運行代碼工具 node.js typescript 基礎知識用node.js來運行)
安裝 typescript 工具包 在編輯器終端執行命令:
npm install -g typescript
創建第一個 ts 檔案
在檔案夾中創建code檔案,
![]()
選擇編輯器打開此檔案

在編輯器中新建hello.ts檔案

在終端中執行 tsc hello.ts 會生成一個hello.js 檔案

node hello.js 運行hello.ts的代碼

簡化運行步驟:
npm install -g ts-node
//運行代碼:
// 一般步驟
tsc hello.ts //先轉成js
node hello.js //再運行代碼
//簡化步驟:
ts-node hello.ts
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/340717.html
標籤:其他
上一篇:8.(開發工具篇elasticsearch)ElasticSearch啟動例外:Failure running machine learning native code
