Fun Project in the creation aims to create JSON AST for formatting, predict how TS interface would look like and much more
Inspired by TS Service
Example of usage:
const source =
'{"name": "John Doe", "age": 16, "isStudent": true , "gradDate": null}'
const scanner = new Scanner(source)
scanner.scan()
const parser = new Parser(scanner.tokens)
parser.parse()
const type = new TSVisitor().execute(parser.tree)
// type = 'interface {name: string, age: number, isStudent: boolean, gradDate: null}'
- Create a scanner
- Create a parser
- Create a visitor
- Accept inner objects
- Scan arrays
- Parse arrays
- Accept Arrays
- Visitor Setup