Closed Fryuni closed 6 months ago
How would such thing look? That part of TS keeps confusing me ngl!
declare module "@vitejs/plugin-react" {
const plugin: TheNeededType;
export = plugin;
}
I have to check what is that type for that plugin, but I think it will be a normal Vite plugin.
This way it type-checks even when the lib is not installed.
Gotcha I see
The barrel export as
astro-integration-kit/utilities
causes types for all utilities to be loaded, which requires all optional dependencies to be present, even if unused.The solution for this is to include a module declaration in the file to prevent the module typing from depending on the presence of the dependency.
Since modules are merged like interfaces, the module declaration can declare a simple export without details.