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

Fix types for generate option #111

Merged
merged 2 commits into from
Aug 3, 2020
Merged

Conversation

JulienPradet
Copy link
Contributor

@JulienPradet JulienPradet commented Jul 10, 2020

Hi there 👋

I've noticed that while the generate option is documented in the plugin, it's not exposed in the Typescript's defintions.

I used the type from https://github.com/sveltejs/svelte/blob/d19bcef6901768844cc89cb39d29873381f9969a/src/compiler/interfaces.ts#L111

It would be possible to change the Options interface to extend the CompileOptions type from Svelte.

+import { CompileOptions } from "svelte/types/compiler/interfaces";

-interface Options {
+interface Options extends CompileOptions {

But it could be misleading since some options are fully handled by the plugin and can't be changed (format, sveltePath, css) and I'm not sure how well it would handle Svelte v2.
I'm definitely not a Typescript expert so I've used the safe way here!

Have a nice day!

PS: if it does not make sense to have the underlying options in the typescript definitions, here is a workaround.

declare module "rollup-plugin-svelte" {
  interface Options {
    generate?: string | false;
  }
}

@lukeed lukeed merged commit 5de6230 into sveltejs:master Aug 3, 2020
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 this pull request may close these issues.

3 participants