• Provides a convenient "meta-transformer" that invokes a handler function for each Node reducing the boilerplate required.

    Note: In the handler return null to remove the Node. The postHandler allows final modification of the SourceFile after all nodes are visited; return a new SourceFile to update it.

    Parameters

    • handler: ((data) => any)

      A function to process AST nodes.

        • (data): any
        • Parameters

          • data: {
                node: Node;
                sourceFile: SourceFile;
            }
            • node: Node
            • sourceFile: SourceFile

          Returns any

    • Optional postHandler: ((sourceFile) => SourceFile)

      A function to postprocess the source file after all nodes visited. Return an updated SourceFile node.

        • (sourceFile): SourceFile
        • Parameters

          • sourceFile: SourceFile

          Returns SourceFile

    Returns ts.TransformerFactory<ts.Bundle | ts.SourceFile>

    JSDoc custom "meta-transformer".