Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Nodejs with Typescript

I would like to use Nodejs in my typescript project and downloaded node.d.ts from https://github.com/borisyankov/DefinitelyTyped/tree/master/node

But VisualStudio finds a lot of errors in the .d.ts file. They're all basically the same:

Error 2 exported interface 'Server' extends interface from private module 'events' C:\Users\lhk\Desktop\typescript-game\strategy go\node\node-0.8.d.ts 236 37 node-0.8.d.ts

All the error messages complain that a private interface is extended.

I searched SO and found this question: nodejs require inside TypeScript file

One of the comments gives the advice to download node.d.ts from the Microsoft samples. I browsed the internet, found this article http://stackful.io/blog/typescript-nodejs-vim-and-linux-oh-my/ and downloaded the second version of node.d.ts , with the exact same result.

Where do I find a proper definitions file for nodejs and Typescript ?

like image 906
lhk Avatar asked Dec 29 '12 16:12

lhk


1 Answers

For the 0.8.1-1 version of TypeScript, use the latest node.d.ts file from this github project: https://github.com/soywiz/typescript-node-definitions

I was getting the same exported interface errors until I pulled the latest definition files from there.

like image 193
JohnnyHK Avatar answered Oct 15 '22 05:10

JohnnyHK