An SBT plugin to run the TypeScript compiler inside of SBT.
The Typescript compiler is provided by this fork. This fork also supports compilation of typescript classes to ExtJs classes.
Currently it supports typescript 1.8
To use this plugin add the following to your plugins.sbt file:
addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-js-engine" % "1.2.3")
addSbtPlugin("be.venneborg.sbt" % "sbt-typescript" % "1.1.0")
This plugin is compatible with sbt-web.
Simply run the tsc command to invoke the TypeScript compiler.
To use this plugin with sbt-web start by enabling SbtWeb in your build.sbt file:
lazy val root = (project in file(".")).enablePlugins(SbtWeb)
Once configured, any *.ts files placed in src/main/assets will be compiled to JavaScript code in target/web/public.
Supported settings:
-
sourceMapWhen set, generates sourceMap files. Defaults tofalse.TypeScriptKeys.sourceMap := true -
esTargetWhich ECMAScript version to transpile to . Defaults toES5.TypeScriptKeys.esTarget := 'ES5' -
noImplicitAnyWhen set, warn on expressions and declarations with an implied 'any' type. Default tofalse.TypeScriptKeys.noImplicitAny := true -
removeCommentsWhen set, do not emit comments to output. Defaults tofalse.TypeScriptKeys.removeComments := true -
moduleTypeSpecify module code generation: Can be 'ExtJs', 'Commonjs' or 'Amd'. Defaults toExtJs.TypeScriptKeys.moduleType in Assets := TypeScriptKeys.ModuleType.AmdTypeScriptKeys.moduleType in TestAssets := TypeScriptKeys.ModuleType.CommonJs
The plugin is built on top of JavaScript Engine which supports different JavaScript runtimes.