Type Acquisition
Type Acquisition is only important for JavaScript projects. In TypeScript projects you need to include the types in your projects explicitly. However, for JavaScript projects, the TypeScript tooling will download types for your modules in the background and outside of your node_modules folder.
enable
Disables automatic type acquisition in JavaScript projects:
{
"typeAcquisition": {
"enable": false
}
}include
If you have a JavaScript project where TypeScript needs additional guidance to understand global dependencies, or have disabled the built-in inference via disableFilenameBasedTypeAcquisition.
You can use include to specify which types should be used from DefinitelyTyped:
{
"typeAcquisition": {
"include": ["jquery"]
}
}exclude
Offers a config for disabling the type-acquisition for a certain module in JavaScript projects. This can be useful for projects which include other libraries in testing infrastructure which aren't needed in the main application.
{
"typeAcquisition": {
"exclude": ["jest", "mocha"]
}
}disableFilenameBasedTypeAcquisition
- Released: 4.1
TypeScript's type acquisition can infer what types should be added based on filenames in a project. This means that having a file like jquery.js in your project would automatically download the types for JQuery from DefinitelyTyped.
You can disable this via disableFilenameBasedTypeAcquisition.
{
"typeAcquisition": {
"disableFilenameBasedTypeAcquisition": true
}
}