RReverser / typescript-estree

TypeScript => ESTree AST converter (WIP)
MIT License
20 stars 2 forks source link

ts => estree, estree => ts #1

Open SamuelMarks opened 9 years ago

SamuelMarks commented 9 years ago

Happy to work on the estree => ts side, but is there a simple example of ts => estree?

RReverser commented 9 years ago

This is exactly ts => estree (test runner does that), estree => ts is not interesting as there is almost no tools that accept TS AST while ESTree has a lot of such.

SamuelMarks commented 9 years ago

Yeah, escodegen is awesome, would be great to extend it with TypeScript syntax support (but first its input needs to be TypeScript AST!)

RReverser commented 9 years ago

Nah, I'm talking about Babel plugins, ESLint and so on. Emitting TypeScript is rarely needed as usually you want to transpile and check the code at the same time without loosy intermediate string representation.

SamuelMarks commented 9 years ago

Oh right, my use-case is different, I am code-generating TypeScript, then reparsing the TypeScript and modifying certain subsets then emitting the replacement TypeScript.

RReverser commented 9 years ago

With ESTree you don't need to generate, reparse and so on as you can simply use ESTree transformations (estraverse, esrecurse, Babel - whatever works best) and treat TypeScript nodes as Flow nodes (unfortunately, I didn't have time to add those but should be trivial enough if you want to contribute).

SamuelMarks commented 9 years ago

Hmm, well if you get the chance a trivial example would be much appreciated :)

TheLarkInn commented 8 years ago

@SamuelMarks @RReverser Did this project get migrated somewhere else. I'm interested in having ESTREE support for TS, so that I can directly integrate it into webpacks Parser which uses acorn parser behind the scenes.

RReverser commented 8 years ago

@TheLarkInn I think https://github.com/eslint/typescript-eslint-parser might be a more up-to-date project with similar goals.

bendtherules commented 6 years ago

@Rreverser While exploring, did you find the ts-tree specification documented somewhere (similar to es-tree)? Working on something and just having that will be really useful

armano2 commented 5 years ago

@bendtherules i started preparing documentation for estree with ts, https://github.com/armano2/typescript-estree-test/blob/master/typescript-estree.spec.d.ts

but this is for https://github.com/JamesHenry/typescript-estree -> used by prettier and typescript-eslint-parser

SamuelMarks commented 5 years ago

So is there a full pipeline now, from ts-tree to TypeScript and back again?