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

Interface ...UserConfig incorrectly extends interface ...UserConfig #3200

Closed
6 tasks done
1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP opened this issue Apr 17, 2023 · 12 comments · Fixed by #3293 or #3303
Closed
6 tasks done

Comments

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

Describe the bug

When executing tsc, I get the following error:

node_modules/vitest/dist/config.d.ts:75:11 - error TS2430: Interface 'import("/mnt/c/XXX/node_modules/vitest/dist/config").UserConfig' incorrectly extends interface 'import("/mnt/c/XXX/node_modules/vite/dist/node/index").UserConfig'.
  Types of property 'test' are incompatible.
    Type 'InlineConfig | undefined' is not assignable to type 'InlineConfig'.
      Type 'undefined' is not assignable to type 'InlineConfig'.

75 interface UserConfig extends UserConfig$2 {
             ~~~~~~~~~~

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-bqveyc

System Info

WSL

  System:
    OS: Linux 4.4 Ubuntu 22.10 22.10 (Kinetic Kudu)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 9.21 GB / 31.65 GB
    Container: Yes
    Shell: 5.2.2 - /bin/bash
  Binaries:
    Node: 19.9.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.3 - /usr/bin/npm
  npmPackages:
    @vitejs/plugin-react: ^3.1.0 => 3.1.0 
    @vitest/coverage-c8: ^0.30.1 => 0.30.1 
    vite: ^4.2.1 => 4.2.1 
    vitest: ^0.30.1 => 0.30.1

Used Package Manager

npm

Validations

@stackblitz
Copy link

stackblitz bot commented Apr 17, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

The error goes away if exactOptionalPropertyTypes is set to false.

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

I think this is simply a mismatch between

test?: ViteUserConfig['test']
and
test?: VitestInlineConfig

@sheremet-va
Copy link
Member

sheremet-va commented May 3, 2023

I think this is simply a mismatch between

Check your package lock. You have several Vite versions installed.

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

Good idea, but I don't think that is the case:

$ npm ls --all | grep vite
├─┬ @vitejs/plugin-react@4.0.0
│ └── vite@4.3.4 deduped
├─┬ @vitest/coverage-c8@0.30.1
│ └── vitest@0.30.1 deduped
├─┬ vite-plugin-svgr@3.1.0
│ └── vite@4.3.4 deduped
├─┬ vite@4.3.4
├─┬ vitest-fetch-mock@0.2.2
│ └── vitest@0.30.1 deduped
├─┬ vitest@0.30.1
│ ├── UNMET OPTIONAL DEPENDENCY @vitest/browser@*
│ ├─┬ @vitest/expect@0.30.1
│ │ ├── @vitest/spy@0.30.1 deduped
│ │ ├── @vitest/utils@0.30.1 deduped
│ ├─┬ @vitest/runner@0.30.1
│ │ ├── @vitest/utils@0.30.1 deduped
│ ├─┬ @vitest/snapshot@0.30.1
│ ├─┬ @vitest/spy@0.30.1
│ ├── UNMET OPTIONAL DEPENDENCY @vitest/ui@*
│ ├─┬ @vitest/utils@0.30.1
│ ├─┬ vite-node@0.30.1
│ │ └── vite@4.3.4 deduped
│ ├── vite@4.3.4 deduped

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

It seems to me like the typings of vite are included in types-c3c9754d.d.ts, but I'm not sure why.

@sheremet-va
Copy link
Member

I don't see any errors in your reproduction.

@github-actions
Copy link

github-actions bot commented May 3, 2023

Hello @1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@sheremet-va
Copy link
Member

Can reproduce it now, you left the comment in tsconfig.

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

Sadly, the issue doesn't seem to be fixed. I updated the stackblitz to 0.31.0, but tsc still gives two errors:

node_modules/vitest/dist/config.d.ts:75:11 - error TS2430: Interface 'import("/home/projects/vitest-dev-vitest-bqveyc/node_modules/vitest/dist/config").UserConfig' incorrectly extends interface 'import("/home/projects/vitest-dev-vitest-bqveyc/node_modules/vite/dist/node/index").UserConfig'.
  Types of property 'test' are incompatible.
    Type 'InlineConfig | undefined' is not assignable to type 'InlineConfig'.
      Type 'undefined' is not assignable to type 'InlineConfig'.

75 interface UserConfig extends UserConfig$2 {
             ~~~~~~~~~~

node_modules/vitest/dist/config.d.ts:78:11 - error TS2430: Interface 'UserWorkspaceConfig' incorrectly extends interface 'UserConfig'.
  Types of property 'test' are incompatible.
    Type 'ProjectConfig | undefined' is not assignable to type 'InlineConfig'.
      Type 'undefined' is not assignable to type 'InlineConfig'.

78 interface UserWorkspaceConfig extends UserConfig$2 {
             ~~~~~~~~~~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/vitest/dist/config.d.ts:75

@elektronik2k5
Copy link

I can confirm: the issue happens to me too with vitest@0.31.0.

@sheremet-va sheremet-va reopened this May 7, 2023
@sheremet-va
Copy link
Member

Should be fixed in 0.31.1

@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants