We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to write a plugin in TypeScript, for example:
import { PluginImpl } from 'rollup' export const myPlugin: PluginImpl<{ }> = () => { return { name: 'my-plugin', transform(code, id) { this.error('There is something wrong.', 42) // Here return undefined } } }
The code compiles and runs. The plugin reports an error at the 42nd character position in any file.
The code won't compile. TypeScript complains that Argument of type '42' is not assignable to parameter of type '{ column: number; line: number; }'.
Argument of type '42' is not assignable to parameter of type '{ column: number; line: number; }'.
In Rollup's type definition file:
rollup/src/rollup/types.d.ts
Line 125 in 1739459
Line 149 in 1739459
While in the document: https://github.com/rollup/rollup/blob/master/docs/05-plugin-development.md#thiserrorerror-string--error-position-number--void
this.error(error: string | Error, position?: number) => void
https://github.com/rollup/rollup/blob/master/docs/05-plugin-development.md#thiswarnwarning-string--rollupwarning-position-number-
this.warn(warning: string | RollupWarning, position?: number)
The text was updated successfully, but these errors were encountered:
Thanks for spotting this! As a matter of fact, both should work—at least there are tests for them. I will have a look at definitions and docs.
Sorry, something went wrong.
Fix at #2975
Successfully merging a pull request may close this issue.
How Do We Reproduce?
I want to write a plugin in TypeScript, for example:
Expected Behavior
The code compiles and runs. The plugin reports an error at the 42nd character position in any file.
Actual Behavior
The code won't compile. TypeScript complains that
Argument of type '42' is not assignable to parameter of type '{ column: number; line: number; }'.
What's Wrong
In Rollup's type definition file:
rollup/src/rollup/types.d.ts
Line 125 in 1739459
rollup/src/rollup/types.d.ts
Line 149 in 1739459
While in the document:
https://github.com/rollup/rollup/blob/master/docs/05-plugin-development.md#thiserrorerror-string--error-position-number--void
https://github.com/rollup/rollup/blob/master/docs/05-plugin-development.md#thiswarnwarning-string--rollupwarning-position-number-
The text was updated successfully, but these errors were encountered: