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

Type 'Plugin' is not assignable to type 'PluginOption', 'Plugin_2'. #1

Closed
rijenkii opened this issue Jan 29, 2023 · 1 comment
Closed

Comments

@rijenkii
Copy link

rijenkii commented Jan 29, 2023

Submitting as asked in vitejs/vite#4454 (comment).

// vite.config.ts
import { defineConfig } from 'vite';
import noBundlePlugin from 'vite-plugin-no-bundle';

export default defineConfig({
  plugins: [noBundlePlugin()],
  build: {
    lib: {
      entry: 'src/index.ts',
    },
  },
});

Part of tsc error:

vite.config.ts:5:13 - error TS2322: Type 'Plugin' is not assignable to type 'PluginOption'.
  Type 'Plugin' is not assignable to type 'Plugin_2'.
Full error
Type 'Plugin' is not assignable to type 'PluginOption'.
  Type 'Plugin' is not assignable to type 'Plugin_2'.
    Types of property 'apply' are incompatible.
      Type '"build" | "serve" | ((config: UserConfig, env: ConfigEnv) => boolean) | undefined' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
        Type '(config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
          Type '(config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '(this: void, config: UserConfig, env: ConfigEnv) => boolean'.
            Types of parameters 'config' and 'config' are incompatible.
              Type 'import("stackblitz:/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").UserConfig'.
                Types of property 'plugins' are incompatible.
                  Type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                    Type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption[]'.
                      Type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption'.
                        Type 'Plugin_2' is not assignable to type 'PluginOption'.
                          Type 'Plugin_2' is not assignable to type 'Plugin'.
                            Types of property 'apply' are incompatible.
                              Type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined' is not assignable to type '"build" | "serve" | ((config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                                Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                                  Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '(config: UserConfig, env: ConfigEnv) => boolean'.
                                    Types of parameters 'config' and 'config' are incompatible.
                                      Type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("stackblitz:/node_modules/vite/dist/node/index").UserConfig'.
                                        Types of property 'plugins' are incompatible.
                                          Type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                            Type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption[]'.
                                              Type 'import("stackblitz:/node_modules/vite-plugin-no-bundle/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("stackblitz:/node_modules/vite/dist/node/index").PluginOption'.
                                                Type 'PluginOption[]' is not assignable to type 'PluginOption'.(2322)

stackblitz link

@ManBearTM
Copy link
Owner

Thanks for the report 🙂 Should be fixed in 2.0.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants