How do you manage external type definitions in a TypeScript project?
Instruction: Explain the process of incorporating and managing DefinitelyTyped (@types) packages in your TypeScript project.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
First check whether the library already ships compatible declarations. If it does, a separate DefinitelyTyped package is usually unnecessary. Otherwise, look for the corresponding @types package and verify its supported library and TypeScript versions; community maintenance does not guarantee that every declaration is current or correct.
Install the runtime library and its development types separately when appropriate. For example, npm install lodash provides runtime code, while npm install --save-dev @types/lodash provides declarations...