Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2014
Embed
What would you like to do?
fs = require 'fs'
pj = require 'prettyjson'
eval fs.readFileSync('node_modules/typescript/bin/typescript.js').toString()
# programText = "class Foo { }"
# console.log process.argv[1]
programText = fs.readFileSync(process.argv[2]).toString()
tree = TypeScript.Parser.parse(
'dummy.ts',
TypeScript.SimpleText.fromString(programText),
# false,
true,
new TypeScript.ParseOptions(TypeScript.LanguageVersion.EcmaScript5, true))
# firstChildKind = tree.sourceUnit().childAt(0).kind()
console.log pj.render tree.sourceUnit(), noColor:true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment