TsSimpleAst

Instantiating

Use the default export from "ts-simple-ast":

import Ast from "ts-simple-ast";

const ast = new Ast();

Custom compiler options

import * as ts from "typescript";

const ast = new Ast({
    compilerOptions: {
        target: ts.ScriptTarget.ES3
    }
});

Custom tsconfig.json

By default, if a tsconfig.json is found in the current working directory then it will use that file for the tsconfig.json.

If you would like to manually specify the path to a tsconfig.json file then specify that:

const ast = new Ast({
    tsConfigFilePath: "path/to/tsconfig.json"
});

Next step: Adding SourceFiles