How to Declare Missing Types for External Libraries
Some third-party libraries can be written in JavaScript. This is not a problem if a library has a declaration file . However, sometimes libraries don't have type declarations. In this case type to find them in DefinitelyTyped repository and install them . If DefinitelyTyped doesn't have type declarations for a library you can declare types yourself. First, in your tsconfig.json add a directory path to type declarations: Notice, that we add both "./node_modules/@types" and "./types" . The first one is the path to types of libraries that have types. The second one is your new directory. In your project's root create a directory called types/ . Inside, create a directory with third-party library name, for example types/thirdPartyLib/ . There, create an index.d.ts file. Then, open this file and declare types: This will make the error go away but you can add actual type declarations for a library: