-
Notifications
You must be signed in to change notification settings - Fork 10
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
Typescript: Provide types for Babel and Vite istanbul options #10
Conversation
@yannbf Can you check this? It's a small change, so I don't think there isn't any problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @bryanjtc thanks a lot for your contribution! This has a side effect though.
This addon is available for both Babel-based projects and Vite-based projects. Therefore, the types are now wrong for Babel projects, given that vite-plugin-istanbul has options that do not exist in babel-plugin-istanbul.
If you'd like this change I'd suggest to:
- Create two separate types and export them as
AddonOptionsBabel
andAddonOptionsVite
- Update the documentation in README and add the options supported by Vite in a way that is clear that it's for Vite projects only
@yannbf I did what you asked and also modified istanbul from addonoptions so that it can be an union type. It can either have the options for the babel plugin or the vite plugin. |
Hey @bryanjtc this is great! thank you so much for following up. I took the liberty to work on top of things, as the type union wouldn't work as well unless we introduced a Discriminated Union, which wouldn't make a lot of sense for js projects. So I simplified things and we just have two exports: |
The interface InstanbulOptions now extends InstabulPluginOptions from the vite plugin instanbul.
This makes available more types when using this plugin in the storybook config with typescript.