Here I have a simple TypeScript project. So far, it only consists of an empty TypeScript file, a package.json without any dependencies, and a default tsconfig.json. Open the terminal and install lodash by typing npm install lodash. Make sure to add the save flag to save the lodash package as a dependency.
Give the type information by npm installing the type declaration package @types/lodash and make sure to save the package as a development dependency. All type declaration packages follow the naming convention @types/ and then the name of the package.
Now that npm install has completed, check out the node_modules folder. You'll find two folders inside, one for lodash and one for all type declaration packages. By convention, the compiler will automatically pick up on all type declarations within the @types folder.
Now that the type declarations are in place, TypeScript can tell us that numbers is of type number array. It also tells us about the range function -- for example, about all its parameter types, its return type, and the documentation.
Finally, head over to the package.json file. You'll find entries for both lodash and its type declarations in here. This means you can treat a type declaration package like any other npm package and install it, restore it, or version it within package.json.