JavaScript Intellisense in TypeScript file

Is it possible to get intellisense in TypeScript files by referencing .ts files to native encoded interfaces?

Is there a solution for existing JavaScript libraries?

+7
source share
3 answers

You can get IntelliSense for other TypeScript files using the external script directive at the top of your script:

 ///<reference path="someOtherScript.ts" /> 

As a side note, the TypeScript help directive IntelliSense does not support the tilde operator, as does the JavaScript help directive. For example, if your script is in "~ / Scripts / foo /", in JavaScript you can reference:

 ///<reference path="~/Scripts/otherScriptFile.js" /> 

whereas in TypeScript you need to reference the current file:

 ///<reference path="../otherScriptFile.ts" /> 

You can learn more about this in section 11.1.1. Source files. Dependencies TypeScript Spec .

Regarding JavaScript IntelliSense in a TypeScript file, it is currently not possible to get a link to JavaScript IntelliSense.

+12
source

As others have already pointed out, I need definition files.

The DefinitelyTyped GitHub Repository provides an excellent (and growing) list of definition files for many popular libraries.

+7
source

You will get intellisense support for each JS code (quality may vary), however, special typescript materials are only available using suitable definition files (* .d.ts).

You can find additional definition files in the source repository (> typing, currently only jQuery and WinJS / RT) http://typescript.codeplex.com/SourceControl/BrowseLatest

+1
source

All Articles