"Method expression is not of function type" error on Typescript constructor call

Using WebStorm 7.0.3.

The IDE is complaining of a "Method expression is not of function type" error on a constructor call, yet the typescript compiler compiles it with no errors, and it runs with no errors. I cannot seem to make the error go away.

The most minimal reproduction I've beel able to create has the following files:

class A {      constructor() {}      public getX():number {           return 3;      } } export = A;

//package.json for a
{      "name": "a",      "main": "./a.js" }

/// <reference path="tsd/node.d.ts" /> var A = require("a"); var a = new A(); // Error is here, on the A() constructor call. console.log(a.getX()); // When compiled and run, still outputs '3' as expected.

Directory structure looks like this:

test |-- main.ts |-- node_modules |   `-- a |       |-- a.ts |       `-- package.json `-- tsd     `-- node.d.ts

I get the feeling I'm probably doing something stupid, but just cannot seem to fix it, so any suggestions are welcome.

Comment actions Permalink

Please try WebStorm8 EAP (http://confluence.jetbrains.com/display/WI/WebStorm+8+EAP) - the issue seems to be fixed there

Comment actions Permalink

Thanks! That does seem to fix it.


Please sign in to leave a comment.