Skip to content

vite-plugin > Type "" is not assignable to type PluginOption #804

@gvillo

Description

@gvillo

Environment

What version are you running?
Vite 7.1.5
Sentry Vite Plugin: 4.3.0

Steps to Reproduce

  1. Bump sentry vite plugin from 3.6.1 to 4.3.0 (actually any 4.x.x produces the same output)
  2. Run typecheck tsc -b
  3. I've a TS error in defineConfig line

Expected Result

It should work in the same way as Sentry Vite Plugin v3 works.

Actual Result

TS Error

Image
TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type
({mode}: ConfigEnv) => {
   plugins: ("" | PluginOption | {
     name: string;
     configResolved(resolvedConfig: ResolvedConfig): void;
     configureServer: () => void;
     writeBundle: () => void;
   } | Plugin$1<...>)[];
   build: { ...; };
   resolve: { ...; };
   server: { ...; };
   test: { ...; };
}
is not assignable to parameter of type UserConfigExport
Type
({mode}: ConfigEnv) => {
   plugins: ("" | PluginOption | {
     name: string;
     configResolved(resolvedConfig: ResolvedConfig): void;
     configureServer: () => void;
     writeBundle: () => void;
   } | Plugin$1<...>)[];
   build: { ...; };
   resolve: { ...; };
   server: { ...; };
   test: { ...; };
}
is not assignable to type UserConfigFnObject
Call signature return types
{
   plugins: ("" | PluginOption | {
     name: string;
     configResolved(resolvedConfig: ResolvedConfig): void;
     configureServer: () => void;
     writeBundle: () => void;
   } | Plugin$1<...>)[];
   build: { ...; };
   resolve: { ...; };
   server: { ...; };
   test: { ...; };
}
and UserConfig are incompatible.
The types of plugins are incompatible between these types.
Type
("" | PluginOption | {
   name: string;
   configResolved(resolvedConfig: ResolvedConfig): void;
   configureServer: () => void;
   writeBundle: () => void;
} | Plugin$1<any>)[]
is not assignable to type PluginOption[]
Type
"" | PluginOption | {
   name: string;
   configResolved(resolvedConfig: ResolvedConfig): void;
   configureServer: () => void;
   writeBundle: () => void;
} | Plugin$1<any>
is not assignable to type PluginOption
Type "" is not assignable to type PluginOption

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions