Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created May 30, 2019 06:56
First version of our transform, which looks at each node and does nothing!
// Dependencies:
import { Node, visitNode, SourceFile, TransformationContext, Transformer, TransformerFactory } from 'typescript';
export function transformer (source: SourceFile): TransformerFactory<Node> {
return function (context: TransformationContext): Transformer<Node> {
return function (node: Node): Node {
return visitNode(node, visit);
};
function visit (node: Node): Node | Array<Node> {
node = visitEachChild(node, visit, context);
return node;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment