代码之家  ›  专栏  ›  技术社区  ›  Totty.js

Typescript文件中是否包含类型检查?

  •  0
  • Totty.js  · 技术社区  · 8 年前

    我认为这与tsconfig中的“include”而不是“files”有关。 Best practice to setup tsconfig "files" vs "include"?

    “打字脚本”:“^2.8.3”

    tsconfig:

    {
      "compilerOptions": {
        "noEmitOnError": false,
        "traceResolution": false,
        "baseUrl": ".",
        "outDir": "build/dist",
        "module": "esnext",
        "target": "es5",
        "lib": ["es6", "dom"],
        "sourceMap": true,
        "allowJs": true,
        "jsx": "react",
        "moduleResolution": "node",
        "rootDir": "src",
        "forceConsistentCasingInFileNames": true,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noImplicitAny": false,
        "strictNullChecks": true,
        "suppressImplicitAnyIndexErrors": true,
        "noUnusedLocals": false,
        "allowUnreachableCode": true
      },
      "exclude": [
        "node_modules",
        "build",
        "scripts",
        "acceptance-tests",
        "webpack",
        "jest",
        "src/setupTests.ts",
        "src/server",
        "config",
        "buildServer"
      ]
    }
    

    网页包。模块。规则:

          {
            test: /\.(ts|tsx)$/,
            include: paths.appSrc,
            use: [
              {
                loader: require.resolve('ts-loader'),
                options: {
                  // disable type checker - we will use it in fork plugin
                  transpileOnly: true,
                },
              },
            ],
          },
    

    网页包。插件:

    new ForkTsCheckerWebpackPlugin({
      async: false,
      watch: paths.appSrc,
      tsconfig: paths.appTsConfig,
    }),
    
    0 回复  |  直到 8 年前
    推荐文章