Enum tsconfig::TypeAcquisition
source · pub enum TypeAcquisition {
Bool(bool),
Object {
enable: bool,
include: Option<Vec<String>>,
exclude: Option<Vec<String>>,
disable_filename_based_type_acquisition: Option<bool>,
},
}
Expand description
Defines how automatic type acquisition behaves.
When you have a JavaScript project in your editor, TypeScript will provide types for your node_modules automatically using the DefinitelyTyped set of @types definitions. This is called automatic type acquisition, and you can customize it using the typeAcquisition object in your configuration.
If you would like to disable or customize this feature, create a jsconfig.json in the root of your project:
{
"typeAcquisition": {
"enable": false
}
}
If you have a specific module which should be included (but isn’t in node_modules):
{
"typeAcquisition": {
"include": ["jest"]
}
}
If a module should not be automatically acquired, for example if the library is available in your node_modules but your team has agreed to not use it:
{
"typeAcquisition": {
"exclude": ["jquery"]
}
}
In TypeScript 4.1, we added the ability to disable the special-casing where a filename would trigger type acquisition:
{
"typeAcquisition": {
"disableFilenameBasedTypeAcquisition": true
}
}
This means that having a file like jquery.js in your project would not automatically download the types for JQuery from DefinitelyTyped.
Variants§
Trait Implementations§
source§impl Clone for TypeAcquisition
impl Clone for TypeAcquisition
source§fn clone(&self) -> TypeAcquisition
fn clone(&self) -> TypeAcquisition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more