Skip to content

Instantly share code, notes, and snippets.

@diverted247
Created November 3, 2015 16:50
Show Gist options
  • Save diverted247/a6f7f68fe03939cdc563 to your computer and use it in GitHub Desktop.
Save diverted247/a6f7f68fe03939cdc563 to your computer and use it in GitHub Desktop.
Vueify Configuration for TypeScript v0.0.1 (Early)
var ts = require("typescript");
module.exports = {
// register custom compilers
customCompilers: {
// for tags with lang="ts"
ts: function( content , cb ){
var compilerOptions = { module: ts.ModuleKind.CommonJS };
var res = ts.transpileModule( content , { compilerOptions: compilerOptions , moduleName: "" , reportDiagnostics: true } );
if( res.diagnostics.length == 0 ){
cb( null , res.outputText )
} else {
var err = "";
var arrayLength = res.diagnostics.length;
for( var i = 0; i < arrayLength; i++ ) {
err += res.diagnostics[i].file.fileName + ": error TS" + res.diagnostics[i].code + ': ' + res.diagnostics[i].messageText + "\n";
}
return cb( err )
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment