Error compiling TypeScript

Hi all;

I added --module to the command line for the typescript compiler. Without the --module I get an error message saying it's required.

And now on the code:

export module App.editor.menu {


    export class File {

        static isOpenEnabled() {

            return false;

        }


        static openClicked() {

            debugger;

        }

    }

}

I get:

"C:/Program Files/nodejs/node_modules/.bin/tsc.cmd" --sourcemap --module menu-handler.ts

warning TS5003: Module code generation 'menu-handler.ts' not supported.

Version 0.9.1.1

Syntax:   tsc [options] [file ..]


Examples: tsc hello.ts

          tsc --out foo.js foo.ts

          tsc @args.txt


Options:

  --allowbool                   Allow 'bool' as a synonym for 'boolean'.

  --allowimportmodule           Allow 'module(...)' as a synonym for 'require(...)'.

  -d, --declaration             Generates corresponding .d.ts file

  -h, --help                    Print this message

  --mapRoot LOCATION            Specifies the location where debugger should locate map files instead of generated locations.

  -m KIND, --module KIND        Specify module code generation: "commonjs" or "amd"

  --noImplicitAny               Warn on expressions and declarations with an implied 'any' type.

  --noResolve                   Skip resolution and preprocessing

  --out FILE                    Concatenate and emit output to single file.

  --outDir DIRECTORY            Redirect output structure to the directory

  --removeComments              Do not emit comments to output

  --sourcemap                   Generates corresponding .map file

  --sourceRoot LOCATION         Specifies the location where debugger should locate TypeScript files instead of source locations.

  -t VERSION, --target VERSION  Specify ECMAScript target version: "ES3" (default), or "ES5"

  -v, --version                 Print the compiler's version: 0.9.1.1

  -w, --watch                   Watch input files

  @<file>                       Insert command line options and files from a file.

4 comments

Hi there,

So what is the question here?


Any way... you have:

--sourcemap --module menu-handler.ts


The help clearly says:

--module KIND        Specify module code generation: "commonjs" or "amd"


Even the error message says the same (where the error is):

warning TS5003: Module code generation 'menu-handler.ts' not supported.



Solution: You should alter your parameters to have either "commonjs" or "amd" AFTER --module option, for example.

--sourcemap --module commonjs menu-handler.ts
0

I figured this out while I had the question open and never hit submit. It must have auto-saved the question or something.

Anyways, yes the AMD fixed it. If I'm using TypeSctipr, RequireJS, and Ext JS, is AMD the correct kind?

thanks - dave

0
If I'm using TypeSctipr, RequireJS, and Ext JS, is AMD the correct kind?

Sorry, not TypeScript or JavaScript guy :(

0

Please sign in to leave a comment.