April 2018
Beginner
536 pages
13h 21m
English
The following code snippet demonstrates how we can use the ts-simple-ast APIs to access and manipulate module import and export declarations.
Just like in the preceding examples, we are going to use the getAst and getSourceFiles methods to access the source code's objects:
import chalk from "chalk"; import Ast, { DiagnosticMessageChain } from "ts-simple-ast"; function getAst(tsConfigPath: string, sourceFilesPath: string) { const ast = new Ast({ tsConfigFilePath: tsConfigPath, addFilesFromTsConfig: false }); ast.addExistingSourceFiles(sourceFilesPath); ...