zoukankan      html  css  js  c++  java
  • typescript开发环境搭建

    typescrip开发环境搭建

    1. 安装Node.js

    2. 安装TypeScript npm install -g typescript

    3. 更新Typescript npm update -g typescript

    4. 查看版本 tsc -v

    5. 安装 Tpyings typings 主要是用来获取.d.ts文件。当typescript使用一个外部JavaScript库时,会需要这个文件,当然好多的编译器都用它来增加智能感知能力。
      输入指令:npm install -g typings

    6. 安装 node 的 .d.ts 库 typings install dt~node –global

    7. npm init,创建package.json

    8. 创建tsconfig.json ts文件 tsc -init

    9. 配置 TypeScript 编译 ctrl + shift + b

    10. 单独编译文件 tsc -w greeter.ts -w代表监视这个文件

    11. 输入tsc -w 监视所有文件

    package.json文件主要说明

    • "name"——包的名称
    • "version"——版本
    • "description"——App描述,方便搜索
    • "scripts"——可执行的脚本
    • "start": "tsc && concurrently "npm run tsc:w" "npm run lite""——同时执行的命令
    • "lite": "lite-server"——启动lite-server服务器
    • "tsc": "tsc"——执行一次TypeScript编译
    • "tsc:w": "tsc -w"——以监控模式运行TypeScript编译器。后台始终保持进程。一旦TypeScript文件变化即会重编译
    • "dependencies"——生产环境中需要的依赖包
    • "devDependencies"——开发中要使用的安装包

    tsconfig.json文件各项说明如下:
    http://json.schemastore.org/tsconfig:

    • "compilerOptions"——编译器选项;
    • "target"——编译目标,如这里编译为es5代码;
    • "module"——处理独立文件时的模块加载方式;
    • "sourceMap"——是否创建map文件以帮助调试;
    • "exclude"——编译器会编译TypeScript文件(.ts或.tsx),通过排除设置里的TypeScript文件不会被编译。
  • 相关阅读:
    Codeforces 691A Fashion in Berland
    HDU 5741 Helter Skelter
    HDU 5735 Born Slippy
    HDU 5739 Fantasia
    HDU 5738 Eureka
    HDU 5734 Acperience
    HDU 5742 It's All In The Mind
    POJ Euro Efficiency 1252
    AtCoder Beginner Contest 067 C
    AtCoder Beginner Contest 067 D
  • 原文地址:https://www.cnblogs.com/jjyyddss/p/7821992.html
Copyright © 2011-2022 走看看