typeRoots and types

By default, every type provided inside a node_modules library, which includes all specific @types/ and package with .d.ts directly inside the library's folder, are read by the TypeScript compiler. However, in some scenarios where there is no definition file available and you need to provide a custom one then you need to specify where the definition file is located. This can be done by using in which you can specify a folder where you define all your definition files. The caveat is that you will need to specify node_modules if you want TypeScript to keep look for definition files in node_modules.

{
"compilerOptions": {
"typeRoots" : ["./typings", “./node_modules”]
}
}

The Types configuration allows cherry-picking which file TypeScript will include. It works in collaboration with typeRoots and is an array. It whitelists the type name.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.10.248