TypeScript Reference ยท tsconfig: Projects, Files and Watch Options
TypeScript typeAcquisition option
Reference for the TypeScript typeAcquisition field: how editors download @types packages for JavaScript projects, and its enable, include and exclude settings.
typeAcquisition is a top-level tsconfig (or jsconfig) field. It controls Automatic Type Acquisition (ATA): a feature of the editor's language service that looks at the packages a JavaScript project uses and downloads matching @types/* packages into a private cache, so you get completions and hover information for plain JavaScript libraries without installing anything yourself.
It is meant for JavaScript projects. The command-line compiler tsc ignores it, and TypeScript projects are expected to install @types packages explicitly.
{ "compilerOptions": { "allowJs": true, "checkJs": false }, "typeAcquisition": { "enable": true, "include": ["jquery"], "exclude": ["lodash"] } }
Try it
ATA lives in the editor, so these examples model its decisions in TypeScript.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Syntax
{ "typeAcquisition": { "enable": true, "include": [], "exclude": [], "disableFilenameBasedTypeAcquisition": false } }
| Property | Description |
|---|---|
enable |
Turns ATA on or off. For a project without a tsconfig (a jsconfig or an implicit project) it is on by default; for a project with a tsconfig it is off unless you set it. |
include |
Package names to always fetch types for. |
exclude |
Package names to never fetch types for. |
disableFilenameBasedTypeAcquisition |
Stops the editor from guessing packages from file names such as jquery.min.js. |
Usage notes
- Editors only.
tscnever downloads anything; install@types/...yourself for builds and CI. - JavaScript projects benefit most. In TypeScript projects, explicit
devDependenciesare more reliable than a hidden cache. - Use
excludefor noise. If the editor fetches a wrong or outdated types package, exclude the library name. - Packages that ship their own types (a
typesfield inpackage.json) do not need@types. - Offline or locked-down machines should keep
enableoff; ATA uses the network and your package manager. - Version drift. Cached types may not match the library version you actually run.