• TypeScript


    TypeScript 使用


    tsconfig.json 文件

    作用:指定项目文件和项目编译所需的配置项。

    生成命令:tsc --init

    文件解析:

    {
      "compilerOptions": {
        "target": "es5", // 生成代码的语言版本
        "lib": [
          "dom",
          "dom.iterable",
          "esnext"
        ], // 指定要包含在编译中的 library
        "allowJs": true, // 允许 ts 编译器编译 js 文件
        "skipLibCheck": true, // 跳过声明文件的类型检查
        "esModuleInterop": true, // es 模块互操作,屏蔽 ESModule 和 CommonJS 之间的差异
        "allowSyntheticDefaultImports": true, // 允许通过 import x from 'y' 及时模块没有显式指定 default 导出
        "strict": true, // 开启严格模式
        "forceConsistentCasingInFileNames": true, // 对文件名称强制区分大小写
        "noFallthroughCasesInSwitch": true, // 为 switch 语句启用错误报告
        "module": "esnext", // 生成代码的模块化标准
        "moduleResolution": "node", //模块解析(查找)策略
        "resolveJsonModule": true, // 允许导入扩展名为 .json 的模块
        "isolatedModules": true, // 是否将没有 import/export 文件市委旧(全局而非模块化)脚本文件
        "noEmit": true, // 编译时不生成任何文件(只进行类型检查)
        "jsx": "react-jsx" // 指定将 JSX 编译成什么形式
      },
      "include": [
        "src"
      ] // 指定允许 ts 处理的目录
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
  • 相关阅读:
    彻底理解Java并发:乐观锁与CAS
    Hbase API
    泛型与反射,看这篇就够了
    08 JUC 之 Semaphore
    残差网络(ResNet)
    JAVA毕设项目客服管理系统(Vue+Mybatis+Maven+Mysql+sprnig+SpringMVC)
    LVGL界面卡顿优化总结
    【esp32-adf】pipeline源码分析
    Re-ID
    840. 矩阵中的幻方。python三连双等 a==b==c
  • 原文地址:https://blog.csdn.net/mygoes/article/details/126480920