eclipse-typescript icon indicating copy to clipboard operation
eclipse-typescript copied to clipboard

cannot have code completion for node.js typings in a nodeclipse project with palantir typescript builder

Open johnson-ajar opened this issue 9 years ago • 1 comments

Hi, I am a java developer trying to set up an dev environment to do some development using nodeclipse and typescript and angular2.

I installed nodeclipse and then eclipse-typescript. Created a simple helloworld typescript nodeclipse project. Then selected the typescript builder.

I create an empty file and then typed. var http = require("http");

then if I type http. you should expect a menu with list of options available, I don't get any. But if type console. then I get a menu with list of options available.

For some reason the code completion for node.js functionality is not working.

I tried including node.d.ts into the projects, but it resulted in error that there is duplicate copy of require.

Not sure how to make the code completion for node.js to work in an nodeclipse project which uses typescript builder.

Please help me to fix this issue.

thanks in advance. Johnson Abraham

johnson-ajar avatar Jul 13 '16 09:07 johnson-ajar

Hey johnson,

In node.d.ts, require extends the following signature:

interface NodeRequireFunction {
    (id: string): any;
}

This means, in particular, that http gets declared as a var with type any. If I do

import * as http from "http";

then I get the autocompletions. Does this help?

markwongsk avatar Jul 13 '16 13:07 markwongsk