Setup tsconfig files vs include TypeScript

Last Updated On Sunday 31st Oct 2021

tsconfig file

typescript files,typescript tsconfig files

Using the Files Property

Basically files is used to specify separate files directly by their path.

	{
    "compilerOptions": {
        // irrelevant
    },
    "files": [
        "core.ts",
        "sys.ts",
        "types.ts",
        "scanner.ts",
        "parser.ts",
        "utilities.ts",
        "binder.ts",
        "checker.ts",
        "emitter.ts",
        "program.ts",
        "commandLineParser.ts",
        "tsc.ts",
        "diagnosticInformationMap.generated.ts"
    ]
}
	

ts config

Using the include and exclude properties

While include and exclude is used to target collections or groups of files or folders etc.

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

References