This project is read-only.

Reference ".d.ts" files from ".js" files?

Topics: General, Language Specification
Oct 2, 2012 at 6:13 PM
Edited Oct 2, 2012 at 6:19 PM

Would it be possible to make the ".d.ts" files reference-able from normal ".js" files, such that we could get Intellisense and static type analysis even in existing JS codebases?

I'm guessing I could get most of this functionality by just configuring Visual Studio to use the TypeScript Editor for *.js files but this would likely also make for some confusing non-standard intellisense as well (e.g. suggesting I use the "class" keyword).

Is this possible today?  If not, could we get it via an update to the TypeScript Editor that would allow it to recognize the difference between ".js" and ".ts" files and change its Intellisense appropriately?

That would be AWESOME!


Oct 2, 2012 at 6:17 PM

+1  I would also love to detangle our existing JS using this functionality.

Oct 5, 2012 at 4:40 PM

I can see how that'd be handy.  I think we'll try to stick with having two different extensions to keep things cleanly separated.  If you can switch a .js file to a TypeScript file by just renaming to .ts, that's pretty easy. 

Oct 8, 2012 at 4:07 AM


Not likely to happen. The project is too big and also has Java devs who use Eclipse working in the JavaScript codebase as well. They would need a TypeScript Editor, too, but it wouldn't fit in with their normal workflow/IDE, then.

How about *.d.js?  ;)