There are two main ways to get declarations for a library: Bundled and DefinitelyTyped.
Bundled - The library bundles its own declaration file. To check if a library has bundled types, look for an index.d.ts file in the project. Some libraries will have it specified in their package.json under the typings or types field.
DefinitelyTyped is a huge repository of declarations for libraries that don’t bundle a declaration file. To get declaration file from DefinitelyTyped run: 'yarn add --dev @types/react' or 'npm i --save-dev @types/react'.