If you have ever tried to keep TypeScript .d.ts
files up-to-date you know how much of a headache it is. So much so that I just don’t mess with it.
Well consider the problem solved. Back in June MSFT announced the future of declaration files.
Declaration files (
.d.ts
files) are a fundamental part of using existing JavaScript libraries in TypeScript, but getting them has always been a place where we’ve known there was room for improvement. As we get closer to TypeScript 2.0, we’re very excited to show off a sneak peak of our plan to simplify things. Getting type declarations in TypeScript 2.0 will require no tools apart from npm.As an example, getting the declarations for a library like lodash will be just an npm command away:
npm install --save @types/lodashFrom there you’ll be able to use lodash in your TypeScript code with no fuss. This works for both modules and global code.
MSFT also has a great tool for searching for @types
packages. It is called TypeSearch. Just like cdnjs.com but for Declaration files.