import * as ts from 'typescript' ; export type NodeTransformer = ( node : ts . Node ) => ts . Node ; export type NodeTransformerFactory = ( context : ts . TransformationContext , sourceFile : ts . SourceFile , typeChecker : ts . TypeChecker ) => NodeTransformer ; export function walker ( sourceFile , ctx , nodeTransformer ? ) { function visitor ( node ) { return ts . visitEachChild ( nodeTransformer ( node ) , visitor , ctx ) ; } return ts . visitEachChild ( sourceFile , visitor , ctx ) ; }