1

I am trying to compile my trypescript app on windows, with

C:/nodejs/tsc.cmd --sourcemap app.ts --module

and this is the error that I get:

C:\nodejs\node_modules\typescript\bin\tsc.js:55708
                    type = type.toLowerCase();
                                ^
TypeError: Cannot call method 'toLowerCase' of undefined
    at Object.opts.option.set (C:\nodejs\node_modules\typescript\bin\tsc.js:55708:33)
    at OptionsParser.parse (C:\nodejs\node_modules\typescript\bin\tsc.js:55258:36)
    at BatchCompiler.parseOptions (C:\nodejs\node_modules\typescript\bin\tsc.js:55771:18)
    at BatchCompiler.batchCompile (C:\nodejs\node_modules\typescript\bin\tsc.js:55328:22)
    at Object.<anonymous> (C:\nodejs\node_modules\typescript\bin\tsc.js:56015:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Ideally, it says that there is a problem with the typescript library itself, but that seems highly unlikely.

I install typescript through npm instal typescript and my version is 0.9.1, any help would be highly appreciated.

This is my typescript code, that I am trying to compile:

///<reference path='node/node.d.ts' />
///<reference path='node/express.d.ts' />

import http = module("http")
import path = module("path")
import express = module("express")
import index = module("./routes/index")
import user = module("./routes/user")

var app = express();

app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function(){
  app.use(express.errorHandler());
});

app.get('/', index.index);
app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function(){
  console.log("Express server listening on port " + app.get('port'));
});

1 Answer 1

1

Specify the module type. Since its node js it would be "commonjs" :

C:/nodejs/tsc.cmd --sourcemap app.ts --module "commonjs" 

Update: To fix http not found compile time error here is a quick typescript definition:

declare module "http"{
}
Sign up to request clarification or add additional context in comments.

2 Comments

Now it gives me errors, saying that file "http" was not found.
@GamesBrainiac Thats a different question but updated answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.