get topLeft() { return this._topLeft; }
set topLeft(value) { this._topLeft = value; Recalc(); }
The above code works find in TypeScript Play, but I received build error
when compiling it from Visual Studio 2012 error "exited with code 1"
Does anyone try get,set in TypeScript and build successfully?
You'll need to target ECMAScript v5, ie pass the -target ES5
argument to the compiler. This needs to be set in the project files target configuration.
I don't know if VS has any built in mechanims for editing target configurations, so i can only tell you how to do it manually. Simply open your .csproj
project file, look for the Target
node where the TypeScript compiler command is located, and add the -target ES5
argument.
In my config it looks like this:
<Target Name="BeforeBuild">
<Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" -target ES5 @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
Update
As of version 0.8.1.0, the hardcoded version dependency was removed and support for source maps was added, and so the Target
node now looks like this by default:
<Target Name="BeforeBuild">
<Message Text="Compiling TypeScript files" />
<Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
<Exec Command="tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
Injecting the target
argument is still pretty easy, simply put it after tsc
or $(TypeScriptSourceMap)
:
<Message Text="Executing tsc --target ES5 $(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
<Exec Command="tsc --target ES5 $(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With