kit: bun run check fails with "Type 'Promise' is not assignable to type 'PluginOption'."

Describe the bug

Hi, I have setup a new sveltekit project with typescript and prettier enabled.

When I run bun run check, I get the error below.

What can I do to get rid of this error?

Reproduction

npm create svelte@latest my-app cd my-app npm install npm run check

Logs

====================================
Loading svelte-check in workspace: /Users/kai/Desktop/my-app
Getting Svelte diagnostics...

/Users/kai/Desktop/my-app/vite.config.ts:5:12
Error: No overload matches this call.
  The last overload gave the following error.
    Type 'Promise<Plugin_2[]>' is not assignable to type 'PluginOption'.
      Type 'Promise<Plugin_2[]>' is not assignable to type 'Promise<false | Plugin_2<any> | PluginOption[] | null | undefined>'.
        Type 'Plugin_2[]' is not assignable to type 'false | Plugin_2<any> | PluginOption[] | null | undefined'.
          Type 'Plugin_2[]' is not assignable to type 'PluginOption[]'.
            Type 'Plugin_2' is not assignable to type 'PluginOption'.
              Type 'Plugin_2' is not assignable to type 'Plugin_2<any>'.
                Types of property 'apply' are incompatible.
                  Type '"build" | "serve" | ((this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"build" | "serve" | ((this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
                    Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                      Type '(this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                        Types of parameters 'config' and 'config' are incompatible.
                          Type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig'.
                            Types of property 'plugins' are incompatible.
                              Type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                Type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption[]'.
                                  Type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption'.
                                    Type 'Plugin_2<any>' is not assignable to type 'PluginOption'.
                                      Type 'Plugin_2<any>' is not assignable to type 'Plugin_2'.
                                        Types of property 'apply' are incompatible.
                                          Type '"build" | "serve" | ((this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"build" | "serve" | ((this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
                                            Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
                                              Type '(this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                                                Types of parameters 'config' and 'config' are incompatible.
                                                  Type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig'.
                                                    Types of property 'plugins' are incompatible.
                                                      Type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                                        Type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[]'.
                                                          Type 'import("/Users/kai/Desktop/my-app/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/kai/Desktop/my-app/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption'.
                                                            Type 'Promise<false | Plugin_2 | PluginOption[] | null | undefined>' is not assignable to type 'PluginOption'.
                                                              Type 'Promise<false | Plugin_2 | PluginOption[] | null | undefined>' is not assignable to type 'Promise<false | Plugin_2<any> | PluginOption[] | null | undefined>'.
                                                                Type 'false | Plugin_2 | PluginOption[] | null | undefined' is not assignable to type 'false | Plugin_2<any> | PluginOption[] | null | undefined'.
                                                                  Type 'Plugin_2' is not assignable to type 'false | Plugin_2<any> | PluginOption[] | null | undefined'. 
export default defineConfig({
	plugins: [sveltekit()],
	test: {


====================================
svelte-check found 1 error and 0 warnings in 1 file
error: script "check" exited with code 1 (SIGHUP)

System Info

System:
    OS: macOS 11.7.10
    CPU: (4) x64 Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
    Memory: 72.07 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.17.1 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
    pnpm: 8.6.3 - /usr/local/bin/pnpm
    Watchman: 2023.09.04.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 117.0.5938.92
    Safari: 16.6
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.20.4 => 1.25.1 
    svelte: ^4.0.5 => 4.2.1 
    vite: ^4.4.2 => 4.4.9

Severity

annoyance

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

one source for multiple versions of vite can be vitest, if you use vite6, you either have to use vitest@beta(^3.0.0-beta.1) or add an override so that vitest@2 uses vite6.

Issues that arise only with Bun are not something we can afford to try help debug. Bun may have reached 1.0, but a lot of it is still very likely to be unstable or not working yet. If it’s operating in a mode that says it’s a drop-in replacement and it’s behaving differently than Node, that sounds like an issue on Bun’s end.

"vitest":"^3.0.0-beta.1" (sorry, i used next tag above, edited now)

re sv cli see https://github.com/sveltejs/cli/pull/353

Screenshot 2023-10-14 at 11 50 52

The issue is resolved. Does not occur in bun version 1.0.6 anymore.

Also, see https://github.com/oven-sh/bun/issues/5677.