Skip to content

"preprocess" types not compatible with Svelte's types #117

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

Closed
maxmilton opened this issue Jul 27, 2020 · 0 comments · Fixed by #118
Closed

"preprocess" types not compatible with Svelte's types #117

maxmilton opened this issue Jul 27, 2020 · 0 comments · Fixed by #118

Comments

@maxmilton
Copy link
Contributor

maxmilton commented Jul 27, 2020

The included types in this package are not compatible with the svelte compiler types. The main thing is the current PreprocessOptions type does not allow returned data from preprocessors.

It's easy enough to ignore the type error but since svelte exports the correct preprocess options type, there's no reason not to use it.

Sample error:
$ tsc --noEmit --allowJs --checkJs
rollup.config.js:80:14 - error TS2345: Argument of type '{ dev: boolean; emitCss: boolean; immutable: boolean; preprocess: { markup: ((options: { content: string; filename: string; }) => Processed | Promise<Processed>) | undefined; style: Preprocessor; }; preserveWhitespace: boolean; }' is not assignable to parameter of type 'Options'.
  Types of property 'preprocess' are incompatible.
    Type '{ markup: ((options: { content: string; filename: string; }) => Processed | Promise<Processed>) | undefined; style: Preprocessor; }' is not assignable to type 'PreprocessOptions'.
      Property 'markup' is incompatible with index signature.
        Type '((options: { content: string; filename: string; }) => Processed | Promise<Processed>) | undefined' is not assignable to type '(...args: any[]) => void'.
          Type 'undefined' is not assignable to type '(...args: any[]) => void'.

80       svelte(svelteOpts),
                ~~~~~~~~~~


Found 1 error.

error Command failed with exit code 1.

Versions

  • rollup-plugin-svelte: 5.2.3
  • svelte: 5.2.3
  • typescript: 3.9.7

References

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

Successfully merging a pull request may close this issue.

1 participant