Headache of Managing TypeScript Declaration Files Solved

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/lodash

From 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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close