This project is read-only.

Warning message appears, disappears and reappears

Topics: General
Jul 27, 2013 at 7:48 AM
Edited Jul 27, 2013 at 1:46 PM

I ran into a problem when trying to work with version in Visual Studio 2013 Preview:

Using the "HTML Application with TypeScript" project, template and type definition files for node.js and Express from the DefinitelyTyped repository, I tried to run a minimal script:

/// <reference path="./node.d.ts" />
/// <reference path="./express.d.ts" />
import express = require('express');
var app = express();

The following warning message occurs: ""Unable to invoke type with no call signatures.". Code completion does not work. For example, it fails when I try o complete "app.g[et]"

Transpiling this file, however, works as expected.

Strangely enough, the warning message disappears and code completion works for a brief period of time (a few seconds), when I switch from "require('express');" to "module('express');" and then back to "require('express');". After this brief period, the problems re-occur.

Any help would be greatly appreciated as I am really looking forward to start developing in TypeScript.


Jul 27, 2013 at 8:29 PM
The following assignment appears to be working:

var app = <Express> express();
Jul 31, 2013 at 12:02 AM
What does express.d.ts have in it?

You can generally only call a module if what's returned from require is also callable. With the older .d.ts files, this would not be the case as they returned only a single module. With the newer compiler, there are typings that would let this work (using "export =" in the .d.ts file, for example), but I'm not sure yet if your express.d.ts uses the new style.