ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
38 lines (26 loc) • 720 B
Markdown
title: Instantiating
## Instantiating
Use the default export from `"ts-simple-ast"`:
```typescript
import Ast from "ts-simple-ast";
const ast = new Ast();
```
### Custom compiler options
```typescript
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:
```typescript
const ast = new Ast({
tsConfigFilePath: "path/to/tsconfig.json"
});
```