What must the module code (writen in typescript) look like to be able to use it like this:
/// <reference path="./onoff.ts" />
//import * as onoff from "./onoff";
var onoff = require("./onoff");
var app = onoff();
var computers: Onoff.Computer[] = [];
app.start(computers);
I was sure it must be this, but it does not work:
import * as express from "express";
export module Onoff {
export class Computer {
}
export class OnoffApp {
start(computers:Computer[], port:number = 3489) {
...
}
}
export default function() {
return new OnoffApp();
}
}
Typescript complains:
service/example.ts(5,11): error TS2349: Cannot invoke an expression whose type lacks a call signature.
service/example.ts(7,16): error TS2503: Cannot find namespace 'Onoff'.
service/example.ts(8,21): error TS2503: Cannot find namespace 'Onoff'.
typings/express/express.d.ts(14,1): error TS6053: File 'typings/serve-static/serve-static.d.ts' not found.
typings/express/express.d.ts(28,34): error TS2307: Cannot find module 'serve-static'.
thank you very much! I have no Idea what I've done wrong...