TypeScript---介紹,安裝和開發工具
視頻地址:https://www.bilibili.com/video/BV1yt411e7xV?from=search&seid=3283823731602112531
1. 安裝:
npm install -g cnpm --registry=http://registry.npm.taobao.org
cnpm install -g typescript
2. 看版本 tsc -v,出來說明安裝成功

3. 運行 ts編譯為es5 (瀏覽器不支持ts和es6),成為index.js檔案

4. 如何自動編譯?在ts檔案里面敲代碼,然后自動編譯為js
VScode配置開發工具,自動編譯.ts檔案
cmd到指定目錄,可以一點點cd, 也可以直接在目錄位置cmd

tsc --init
生成tsconfig.json
修改里面outDir,保存

terminal runtask typescript watch
就可以自動編譯

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/104022.html
標籤:JavaScript
上一篇:Jest 前端單元測驗工具
