Typings describes contract of libraries you use. This allows the TypeScript compiler that what you use exist (classes, properties, ...).
You can install typings from a repository using the typings
command or let the compiler find out them leveraging the strategy specified in the tsconfig.json
file with the moduleResolution
attribute.
For Angular2, they (.d.ts
files) are resolved within the node_modules/@angular
folder since the framework contains its typings. For other libraries, like Lodash, it's not the case. So you need to install them from the repository.
To define a typings file you can leverage the export declare class
clause:
export declare class SomeClass {
name: String;
constructor(name?: String);
}