microsoft / ngconf2015demo

TodoMVC application demo for ng-conf 2015

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

export class in sublime

manfredsteyer opened this issue · comments

Hi,

I've played around with the sublime plugin and found out, that I get an error from sublime, when I try to export something, for instance a class:

export class Formatter {
    format(str: String) {
        return "*" + str.toUpperCase() + "*";
    }
}

The error-message tells me, that I need to set the '--module' flag.

I've compared this to the provided sample to find out, why this issue dosn't arise there and found out, that sublime only shows this error, when there is no import-statement on the top of the file. When I add the following, for instance, everything is fine:

import {} from 'annotations';

Is there a way to work around that?

Wishes,
Manfred

The issue is that the default compiler options for the language service do not include setting the module flag. The solution will be to use tsconfig.json to set compiler options. This is not hooked up yet. We are also considering putting compiler options in a Sublime setting for the TypeScript plug-in. In the meantime, the import workaround you already found is as good as anything else.

I see. Thanks for this quick reply!
Best wishes,
Manfred

I have pushed an update (f794ad5) to make the default module kind to AMD, which seems to be more appropriate in the context of this demo. @manfredsteyer can you update your plugin and give it a try, the error should be