files is the exact-list version of include: file paths, no patterns, relative to the config file. A path that does not exist is an error. When both are set, the program starts from both lists.
As with include, imports pull more files in: start from src/main.js alone and every file it imports is read and checked, as the example shows. That makes files handy for an entry-point-only config, such as one that checks a script and nothing else.
At a glance
| Write | Rarely needed: include with a folder or pattern is easier to keep up to date |
|---|---|
| On the command line | No flag: only a config file can set it |
| Type | string[] |
| Default in TypeScript 5.9 | not set |
| Description in the tsconfig.json schema | Specifies an allowlist of files to include in the program. |
The description is quoted from the tsconfig.json schema published by SchemaStore (Apache-2.0), which carries the descriptions TypeScript does not ship for top-level keys; see the notices.
Examples
export function formatPrice(cents) {error TS7006: Parameter 'cents' implicitly has an 'any' type.
return `$${(cents / 100).toFixed(2)}`;
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"files": [
"src/main.js"
]
} A config for one entry point
A small repository can keep a second config, say jsconfig.scripts.json, with "files": ["scripts/release.js"], and check it with tsc -p jsconfig.scripts.json. Everything that script imports is checked with it, and nothing else is.
Gotchas
- With
filesset and noinclude, the defaultincludeof everything no longer applies.
Sources
- TSConfig Reference: files · TypeScript
- tsconfig.json schema · SchemaStore
Last reviewed 20 October 2026.