Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2014 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/cd3a366caaa615e6bfa4 to your computer and use it in GitHub Desktop.
Save anonymous/cd3a366caaa615e6bfa4 to your computer and use it in GitHub Desktop.
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