jsconfig.json option

allowJs

  • Default false
  • true in jsconfig.json
  • Since TypeScript 1.8

allowJs lets JavaScript files into the program. tsc reads them, works out the types of what they export (from JSDoc where there is some, by inference elsewhere), and lets other files use those types. It does not report errors inside them: that is checkJs.

A file named jsconfig.json turns allowJs on by default, and in TypeScript 5.9 checkJs turns it on when you leave it out. In a JavaScript project you rarely write it; it matters in a tsconfig.json, and in projects that mix .ts and .js files.

At a glance

Write Nothing in a jsconfig.json, where it is already on. In a tsconfig.json, write "allowJs": true (or let "checkJs": true imply it)
On the command line --allowJs
Type boolean
Default in TypeScript 5.9 false (on when checkJs is on and allowJs is left out)
Default in a jsconfig.json true
TypeScript's description Allow JavaScript files to be a part of your program. Use the 'checkJs' option to get errors from these files.

The description is quoted from TypeScript's own option list (Apache-2.0); see the notices.

Examples

checkout.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: checkout.js(5,27): error TS2322: Type 'string' is not assignable to type 'number'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. checkout.js(5,27): error TS2322: Type 'string' is not assignable to type 'number'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. checkout.js(5,27): error TS2322: Type 'string' is not assignable to type 'number'. checked 21 October 2026
import { orderTotal } from "./legacy.js";

console.log(orderTotal([{ price: 400, qty: 2 }]));
console.log(orderTotal([{ price: "4.00", qty: 2 }]));error TS2322: Type 'string' is not assignable to type 'number'.
A file in the program but not checked still gives its types to the files that are.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": [
    "*.js"
  ]
}

In the program, but not checked

The example shows the difference in one project. legacy.js opts out of checking with // @ts-nocheck, so it is in the program the way allowJs alone puts a file there: its JSDoc still types orderTotal, and the call in checkout.js that passes a string price is an error. The misspelled toUppercase inside legacy.js is never reported, because nothing checks that file.

That is the whole job of allowJs: types flow out of JavaScript files. Turning on checkJs, or adding // @ts-check to one file, is what makes their own mistakes visible.

When you need to write it

Three cases, all outside a plain jsconfig.json:

  • a config file named tsconfig.json for a JavaScript project: write "checkJs": true (which implies allowJs in TypeScript 5.9) or both
  • a TypeScript project with some .js files left in it: "allowJs": true with checkJs off lets .ts files import them, and // @ts-check opts single files in as you convert them
  • a project that writes output from .js files (Babel-free downlevel builds, or .d.ts files for a package): allowJs is what lets those files be inputs

Gotchas

  • With allowJs and output turned on, tsc writes .js files. Without outDir or noEmit, it would write over your sources, so it stops with TS5055 instead.
  • JavaScript files inside node_modules are a separate setting: maxNodeModuleJsDepth decides whether TypeScript reads them.
  • Setting "allowJs": false while "checkJs": true is a config error in TypeScript 5.9 (TS5052): checking JavaScript needs JavaScript in the program.

Questions

Does allowJs check my JavaScript?

No. It makes .js files part of the program so their types are known. Errors inside them are reported only with checkJs on, or in a file that starts with // @ts-check.

Sources

Last reviewed 20 October 2026.