Exclude with pattern in tsconfig.json

Solution 1:

Full example if anyone needs it:

{
  "compilerOptions": {
    ...
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "src/**/*.spec.ts"
  ]
}

Solution 2:

Globs work in Typescript 2.0+. You would do "exclude" : ["src/**/*.spec.ts"] in your tsconfig.json.

More

https://basarat.gitbook.io/typescript/content/docs/project/files.html