Altering the lib.d.ts that Visual Studio uses

Topics: General
Jan 10, 2013 at 4:47 AM

I know it seems like a bad idea to do, but I want to alter the lib.d.ts to provide intellisense for some features not present in the default definition file. I don't want to require my users to manually reference my declaration. Is the lib.d.ts that the TypeScript extension visible? Neither the npm one nor the one in C:\Program Files (x86)\Microsoft SDKs\TypeScript\ is doing the trick.


Is this possible?

Jan 10, 2013 at 1:32 PM

I am unclear about what you are trying to achieve. Can you explain a little bit more?

Jan 10, 2013 at 1:36 PM
You have to patch the resource from the addin at runtime.

On Thu, Jan 10, 2013 at 4:32 PM, choudeshell <> wrote:

From: choudeshell

I am unclear about what you are trying to achieve. Can you explain a little bit more?

Read the full discussion online.

To add a post to this discussion, reply to this email (

To start a new discussion for this project, email

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at

Jan 10, 2013 at 3:44 PM

To explain very simply, I want to alter the base declaration lib.d.ts that is distributed w/ the extension to incorporate some other changes that can be used by the user with intellisense but does not need to be explicitly ///<reference'd. I was thinking about altering the language service DLL directly and changing the string resource inside of it, but the extension has an anti-extensible type of license which scares me. This all makes me very sad for something I was hoping was more open.

Jan 10, 2013 at 5:08 PM

Lib.d.ts carries an Apache 2.0 licence - so you can modify it and distribute it.

That said, I would not do this. You as the author of these modifications would need to keep pace with TypeScript releases or force your users to use an older version of TypeScript, compatible with your modifications.


Jan 10, 2013 at 5:11 PM

We've put some work recently into making it easier to swap out the language service and lib.d.ts for the language service.  The fixes should be showing up in the next release, 0.8.2, which is coming out in a couple weeks.

Jan 10, 2013 at 7:04 PM

Fantastic Jon, thanks.

Jan 24, 2013 at 10:27 PM

Now that 0.8.2's out, I'd like to bring this up again. I noticed in the blog post saying I could swap out the language service (and the default lib), but I am struggling to find where I can do this. Altering the lib.d.ts in the SDK still does not persist. And I cannot find where I can interchange the language service. Can you give some more info here? I see I can likely alter the .targets MSBuild files to change the tsc execution parameters but that's it. Any hints?

Apr 3, 2013 at 9:35 PM
Apologies for the grave digging, but I feel this issue needs further clarification.

I'm working on a preprocessor, which would add some syntax to TypeScript (namely the ability to #define keywords), and I would like VS not to flag errors for defined names (since, without the changes, they'd result in syntax errors or, at the very least, undefined symbols).

Is it finally possible to replace the language service by swapping out TypeScript.js and tsc.js in the SDK folder?
Apr 3, 2013 at 10:35 PM