Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a *.d.ts file (and the corresponding JS) in a TypeScript project using PHPStorm

I want to dive into TypeScript (because to me it looks very promising) and therefore I want to rewrite a little JS project of my own.

So I started to create some classes (each class in a seperate file), but I'm a little bit confused about those *.d.ts files.

How do I exactly work with them? Do I need to reference them in the .ts files? Because PHPStorm seems to index the *.d.ts file anyway.

I'm using grunt-ts (https://github.com/grunt-ts/grunt-ts) to compile the project down to JavaScript, seems that this one needs the reference files.

But when I'm referencing it like so in the first line:

///<reference path="../../../lib/typed/jquery.d.ts">

The compiler says:

....Model.ts(37, 20): error TS1084: Invalid reference directive syntax.

What am I missing?

like image 865
Johannes Klauß Avatar asked Apr 10 '14 08:04

Johannes Klauß


1 Answers

That needs to be a self closing tag :

///<reference path="../../../lib/typed/jquery.d.ts" />

Notice /> at the end

like image 67
basarat Avatar answered Oct 09 '22 14:10

basarat