7

Is it only possible to get IntelliSense in TypeScript files by referencing .ts files with own coded interfaces?

Is there a solution for existing JavaScript libraries?

2
  • Hopefully there will be, but as of right now, I don't think there are any. Commented Oct 7, 2012 at 15:59
  • Is there anything new on using JS Intellisense in TS files? Commented Nov 18, 2016 at 12:53

3 Answers 3

13

You are able to get IntelliSense for other TypeScript files by using an external script reference directive at the top of your script:

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

As a side note, the TypeScript IntelliSense reference directive doesn't support the tilde operator like the JavaScript reference directive does. For example, if your script is located in "~/Scripts/foo/", in JavaScript you can reference:

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

whereas in TypeScript you have to reference relative to the current file:

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

More info about this can be found in section 11.1.1 Source Files Dependencies of the TypeScript Spec.

With regard to JavaScript IntelliSense in a TypeScript file, it currently appears to be not possible to get JavaScript reference IntelliSense.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there anything new on using JS Intellisense in TS files?
7

As others before me have pointed out, you need the definition files.

The DefinitelyTyped GitHub repository provides an excellent (and growing) list of definition files for a lot of popular libraries.

Comments

1

You'll get intellisense support for every JS code (quality may vary), however the typescript specific stuff is only available when using apropriate definition files (*.d.ts).

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.