iwhp
iwhp

Reputation: 843

TypeScript 0.9.* VisualStudio TS5037: Cannot compile external modules unless the '--module' flag is provided

I do get the TypeScript compiler error TS5037: Cannot compile external modules unless the '--module' flag is provided.

I am using TypeScript 0.9.1.1 und Visual Studio 2012.

Where can I set the --module option in Visual Studio?
Web Essential seems to no longer support this option in the dialog.

Thankx, Harry

Update:
I have a configuration file (config.ts) for my project. This file contains many statements as the following:

export var loggedInUserId: number = 0;  

There are no other statements as the one before. Do I have to define a class or module around it?

Upvotes: 10

Views: 6831

Answers (2)

Nathanael Schulte
Nathanael Schulte

Reputation: 650

I was having this problem in Visual Studio 2013, even with that setting above set correctly. It turns out there's a project-level setting as well. If you go to Project Settings on the project with TypeScript (highlight the project and type Alt+Enter), then go to the TypeScript Build tab, and select AMD under "Module System"

enter image description here

Upvotes: 34

basarat
basarat

Reputation: 276195

You can find the option for non project files here (Tools - options - Editor - TypeScript):

enter image description here

For my project based work I use grunt : https://github.com/basarat/grunt-ts

Upvotes: 9

Related Questions