// @ts-nocheck is the opposite of // @ts-check: written before the first line of code, it stops error reporting for that one file while checkJs keeps checking every other file. It arrived for JavaScript files with TypeScript 2.3, and .ts files have honored it since 3.7.
The file is still part of the program. Its JSDoc still types what it exports, so a file that imports total from it is checked against those types; only the mistakes inside the skipped file go unreported, as the two examples show.
At a glance
| Write | // @ts-nocheck |
|---|---|
| Applies to | The whole file, when it comes before the first line of code |
| With checkJs on | Skips this file: no errors are reported in it, but its types still reach the files that import it |
| With checkJs off | Nothing: the file is not checked anyway |
Examples
// @ts-nocheck
/**
* @param {{ price: number }[]} items
* @returns {number}
*/
export function total(items) {
return items.reduce((sum, item) => sum + item.price, 0);
}
/** @param {string} name */
export function shout(name) {
return name.toUppercase();
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} /**
* @param {{ price: number }[]} items
* @returns {number}
*/
export function total(items) {
return items.reduce((sum, item) => sum + item.price, 0);
}
/** @param {string} name */
export function shout(name) {
return name.toUppercase();error TS2551: Property 'toUppercase' does not exist on type 'string'. Did you mean 'toUpperCase'?
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} Using it during a migration
Turn on checkJs for the whole project, add // @ts-nocheck to the files that report too much, and remove the comments one file at a time. New files are checked from the start, and grep -l "@ts-nocheck" lists what is left.
Gotchas
- If a file has both
// @ts-checkand// @ts-nocheck, the later of the two wins. - Like
// @ts-check, it counts only before the first line of code.
Sources
- JS Projects Utilizing TypeScript · TypeScript handbook
- TypeScript 2.3 release notes · TypeScript handbook
- TypeScript 3.7 release notes · TypeScript handbook
Last reviewed 20 October 2026.