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

Bug: Type error caused by peerDependency installation #28160

Open
landsman opened this issue Feb 17, 2025 · 4 comments
Open

Bug: Type error caused by peerDependency installation #28160

landsman opened this issue Feb 17, 2025 · 4 comments
Labels
question a question about the use of Deno

Comments

@landsman
Copy link

landsman commented Feb 17, 2025

Please help me fix this. Is it a problem of the new Deno version?
Build and dev works fine, but VSCode and Idea shows me following errors.

  • npm:@deno/vite-plugin@^1.0.0
  • npm:@vitejs/plugin-react@^4.3.4

Repository for reproduction: https://github.com/landsman/music/blob/dev/src/web/vite.config.ts

No overload matches this call.
  The last overload gave the following error.
    Type 'Plugin<any>[]' is not assignable to type 'PluginOption'.
      Type 'Plugin<any>[]' is not assignable to type 'PluginOption[]'.
        Type 'Plugin<any>' is not assignable to type 'PluginOption'.
          Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").Plugin<any>' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").Plugin<any>'.
            Types of property 'hotUpdate' are incompatible.
              Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/rollup/4.34.6/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> | ...' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/rollup/4.34.6/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> ...'.
                Type '(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
                  Type '(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>' is not assignable to type '(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>'.
                    The 'this' types of each signature are incompatible.
                      Type 'HotUpdatePluginContext' is not assignable to type 'HotUpdatePluginContext'. Two different types with this name exist, but they are unrelated.
                        The types of 'environment.pluginContainer.environment' are incompatible between these types.
                          Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").Environment' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").Environment'.
                            Type 'DevEnvironment' is not assignable to type 'Environment'.
                              Type 'PluginOption[]' is not assignable to type 'PluginOption'.
                                Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").PluginOption[]' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").PluginOption[]'.
                                  Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").PluginOption' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").PluginOption'.
                                    Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                                      Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").Plugin<any>' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").Plugin<any>'.
                                        Types of property 'hotUpdate' are incompatible.
                                          Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/rollup/4.34.6/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> | ...' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/rollup/4.34.6/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> ...'.
                                            Type '(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
                                              Type '(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>' is not assignable to type '(this: HotUpdatePluginContext, options: import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>'.
                                                The 'this' types of each signature are incompatible.
                                                  Type 'HotUpdatePluginContext' is not assignable to type 'HotUpdatePluginContext'. Two different types with this name exist, but they are unrelated.
                                                    The types of 'environment.pluginContainer.environment' are incompatible between these types.
                                                      Type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0_1/dist/node/index").Environment' is not assignable to type 'import("file:///Users/landsman/Library/Caches/deno/npm/registry.npmjs.org/vite/6.1.0/dist/node/index").Environment'.
                                                        Type 'DevEnvironment' is not assignable to type 'Environment'.deno-ts(2769)
index.d.ts(3625, 18): The last overload is declared here.
(alias) deno(): Plugin[]
import deno
@landsman
Copy link
Author

landsman commented Feb 17, 2025

I updated to 1.0.4 and problem on deno plugin is gone, react still remains.

Is it a problem in vite-plugin-react? Can you please suggest them to fix it?

@marvinhagemeister
Copy link
Contributor

What's the react problem you're referring to? The error output you shared doesn't mention that unless I'm missing something.

@marvinhagemeister marvinhagemeister added the question a question about the use of Deno label Feb 17, 2025
@landsman
Copy link
Author

Image

Deno: No overload matches this call.
The last overload gave the following error.
Type PluginOption[] is not assignable to type PluginOption
Type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").PluginOption[]' is not assignable to type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").PluginOption[]'.
Type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").PluginOption' is not assignable to type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").PluginOption'.
Type Plugin<any> is not assignable to type PluginOption
Type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").Plugin<any>' is not assignable to type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").Plugin<any>'.
Types of property hotUpdate are incompatible.
Type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ rollup/ 4.34.6/ dist/ rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> | ...' is not assignable to type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ rollup/ 4.34.6/ dist/ rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>> ...'.
Type '(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
Type '(this: HotUpdatePluginContext, options: import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>' is not assignable to type '(this: HotUpdatePluginContext, options: import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>'.
The this types of each signature are incompatible.
Type HotUpdatePluginContext is not assignable to type HotUpdatePluginContext. Two different types with this name exist, but they are unrelated.
The types of environment. pluginContainer. environment are incompatible between these types.
Type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0_1/ dist/ node/ index").Environment' is not assignable to type 'import("file:/// Users/ landsman/ Library/ Caches/ deno/ npm/ registry. npmjs. org/ vite/ 6.1.0/ dist/ node/ index").Environment'.
Type DevEnvironment is not assignable to type Environment

@marvinhagemeister marvinhagemeister changed the title typescript errors on plugins in vite.config.ts Bug: Type error caused by peerDependency installation Feb 18, 2025
@marvinhagemeister
Copy link
Contributor

I see, that seems like an issue with peerDependencies in Deno itself

@marvinhagemeister marvinhagemeister transferred this issue from denoland/deno-vite-plugin Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question a question about the use of Deno
Projects
None yet
Development

No branches or pull requests

2 participants