zoukankan      html  css  js  c++  java
  • Node+TS+Koa+vue 商城全栈(四) 配置ts开发环境

    1.创建 tsconfig.json 文件

    // 全局安装 typescript
    npm install -g typescript
    
    // 更新 typescript
    npm update -g typescript
    
    // 查看版本
    tsc -v
    
    // 初始化
    tsc --init

    2.tsconfig.json

    {
      "compilerOptions": { /* 编译选项 */
        "module": "commonjs", /* 模板 */
        "target": "es2017", /* 生成的目标代码 */
        "outDir": "./dist", /* 生成目录 */
        "noImplicitAny": true, /* 如果有any类型时报错 */
        "removeComments": true, /* 移除注释 */
        "sourceMap": true, /* 是否保留.map文件 */
        "experimentalDecorators": true, /* 是否支持装饰器 */
        "emitDecoratorMetadata": true, /* 是否支持元素 */
        "typeRoots": [ /* 类型声明文件的地址 */
          "node_modules/@types", /* 默认 */
          "@miaov-types" /* 自定义 */
        ]
      },
      "compileOnSave": true, /* 保存时自动编译 */
      "includes": [ /* 包含文件 */
        "app/**/*"
      ],
      "exclude": [ /* 排除文件 */
        "node_modules",
        "dist",
        "models",
        "migrations",
        "seeders",
        "test"
      ]
    }
    

    3.监听变化

    tsc -w
    

    .

  • 相关阅读:
    Python实现网络多人聊天室
    C实现string字符串
    C getchar()
    C++ 数组遍历的两种方式
    Java 发红包
    Java递归实现阶乘
    Go defer语句
    bash shell——sum
    C——letterCounter
    数据结构——链队列(linked queue)
  • 原文地址:https://www.cnblogs.com/crazycode2/p/12238414.html
Copyright © 2011-2022 走看看