Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Please specify propery type for ts.TransformerFactory in the entry-point and example #147

Open
bogeeee opened this issue Feb 26, 2024 · 0 comments

Comments

@bogeeee
Copy link

bogeeee commented Feb 26, 2024

In the readme, it says
(program: ts.Program, config: PluginConfig, extras: TransformerExtras) => ts.TransformerFactory
which is read as ts.TransformerFactory<any> but that's wrong imho because the type param / shouldn't be any

Also the example gives me a type error, when i try to specify it either via, what's in the readme

export default function(program: ts.Program, pluginConfig: PluginConfig, { ts: tsInstance }: TransformerExtras): (context: ts.TransformationContext) => (sourceFile: ts.SourceFile) => ts.SourceFile {
    ...
}

or via (taken from other projects):

export default function(program: ts.Program, pluginConfig: PluginConfig, { ts: tsInstance }: TransformerExtras): ts.TransformerFactory<ts.SourceFile> {
    ...
}

or as returning ts.TransformerFactory<ts.Node> ... nothing works.

So this is rather unclear for a new user, what type should be returned.
Thx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant