Created
January 14, 2013 09:50
-
-
Save pvdz/4528967 to your computer and use it in GitHub Desktop.
Minimal TypeScript compile case. Ouch..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compile(source) { // derived from www.typescriptlang.org/Playground/ | |
var result = ''; | |
var outfile = {Write:function(s){ result += s; }, WriteLine:function(s){ result += s + '\n'; }, Close:function(){}}; | |
var compiler = new TypeScript.TypeScriptCompiler(); | |
compiler.setErrorCallback(function(start, len, message) { console.log('error',arguments); }); | |
compiler.parser.errorRecovery = true; | |
compiler.addUnit(source, "input.ts"); | |
compiler.emit(function createFile(fileName) { return outfile; }); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also. What's up with the capitalized methods? :'(