Skip to content

Type error with vite 7 #656

@marekdedic

Description

@marekdedic

Hi, after updating to Vite 7, I get the following TS error:

vite.config.ts(20,13): error TS2769: No overload matches this call.
  The last overload gave the following error.
    Type 'Plugin<any>' is not assignable to type 'PluginOption'.
      Type 'import("/home/user/project/node_modules/rollup/dist/rollup").Plugin<any>' is not assignable to type 'import("/home/user/project/node_modules/vite/dist/node/index").Plugin<any>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
        Types of property 'resolveId' are incompatible.
          Type 'ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean; }) => ResolveIdResult | Promise<...>, { ...; }>' is not assignable to type 'ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; ssr?: boolean | undefined; isEntry: boolean; }) => ResolveIdResult | Promise<...>, { ...; }>'.
            Type '{ handler: (this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean; }) => ResolveIdResult | Promise<...>; order?: "pre" | ... 1 more ... | null; } & { ...; }' is not assignable to type 'ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; ssr?: boolean | undefined; isEntry: boolean; }) => ResolveIdResult | Promise<...>, { ...; }>'.
              Type '{ handler: (this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean; }) => ResolveIdResult | Promise<...>; order?: "pre" | ... 1 more ... | null; } & { ...; }' is not assignable to type '{ handler: (this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; ssr?: boolean | undefined; isEntry: boolean; }) => ResolveIdResult | Promise<...>; order?: "pre" | ... 1 more ... | null; } & { ...; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                Type '{ handler: (this: PluginContext, source: string, importer: string | undefined, options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean; }) => ResolveIdResult | Promise<...>; order?: "pre" | ... 1 more ... | null; } & { ...; }' is not assignable to type '{ filter?: { id?: StringFilter<RegExp>; }; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                  The types of 'filter.id' are incompatible between these types.
                    Type 'StringFilter<RegExp> | undefined' is not assignable to type 'StringFilter<RegExp>'.
                      Type 'undefined' is not assignable to type 'StringFilter<RegExp>'.

See marekdedic/imagelightbox#1384 for a complete repro

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions