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(README.md#L151): Documentation inaccuracies #4

Closed
sunrabbit123 opened this issue Apr 3, 2023 · 0 comments
Closed

Docs(README.md#L151): Documentation inaccuracies #4

sunrabbit123 opened this issue Apr 3, 2023 · 0 comments

Comments

@sunrabbit123
Copy link
Contributor

sunrabbit123 commented Apr 3, 2023

microsoft/TypeScript#14419 (comment)

Hello @sunrabbit123

Your documentation shows an incomplete type declaration for the plugins:

(program: ts.Program, config?: PluginConfig) => ts.TransformerFactory;

In fact there is a third argument which is important.

(program: ts.Program, config: PluginConfig, helpers: { ts: typeof ts; addDiagnostic: (diag: ts.Diagnostic) => void }) => ts.TransformerFactory;

Passing references to ts makes the plugin completely dependency-free.
Passing callback addDiagnostic allows it to interact with the user in accordance with the compiler standard (instead of console.log).

I think it's important that authors of their own compilers and plugins maintain this standard.

sunrabbit123 added a commit that referenced this issue Apr 6, 2023
In TS5.0 and later, an error occurs related to ts-node.
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