Skip to content

Add support ttypescript transformer interface  #12

@cevek

Description

@cevek

I wrote a tool which patch ts on the fly and add support for custom transformers from tsconfig.json
https://github.com/cevek/ttypescript

{
    "compilerOptions": {
        "plugins": [
            {
                "customTransformers": {
                    "before": ["ts-transformer-keys"],
                }
            }
        ]
    }
}

but it works slightly different by calling your transformer directly and provide the program as second argument
This is transformer example:

import * as ts from 'typescript';
export default (ctx: ts.TransformationContext, program: ts.Program): ts.Transformer<ts.SourceFile> => {
    return sourceFile => {
        function visitor(node: ts.Node): ts.Node {
            return ts.visitEachChild(node, visitor, ctx);
        }
        return ts.visitEachChild(sourceFile, visitor, ctx);
    };
};

If you accept PR, I can add support for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions