複数のファイルを手軽にbuildして試す環境を作る(with tsconfig exclude)

tsconfig.jsontscに渡すオプションを指定できる。

tscに渡すファイルの指定は以下のオプションを利用して渡す模様

  • files
  • exclude

filesはファイルを明示的に指定する必要がありglobパターン的なものは使えない。 excludeを使ってごまかす事はできるかもしれない。

https://github.com/Microsoft/TypeScript/wiki/tsconfig.json#details

If no "files" property is present in a tsconfig.json, the compiler defaults to including all TypeScript (.ts or .tsx) files in the containing directory and subdirectories. When a "files" property is present, only the specified files are included.

If the "exclude" property is specified, the compiler includes all TypeScript (.ts or .tsx) files in the containing directory and subdirectories except for those files or folders that are excluded.

The "files" property cannot be used in conjunction with the "exclude" property. If both are specified then the "files" property takes precedence.

とりあえず以下のようなtsconfig.jsonを使うことにする

{
    "compilerOptions": {
        "noImplicitAny": true,
        "noEmitOnError": true,
        "module": "commonjs",
        "target": "ES5",
        "moduleResolution": "node"
    },
  "exclude": [
    "node_modules"
  ]
}