-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
p2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pending triage
Description
Describe the bug
If you have exactOptionalPropertyTypes enabled then various parts of vitest do not compile.
There are 249 errors inside the repo if you compile with it but what's more important is that it's observable for users.
I'd be happy to contribute these fixes but I want to know if I should limit to what users can observe (e.g. errors within the output .d.ts files) or fix it even within function bodies.
Reproduction
This is personally how I ran into it:
import type { VitestRunner } from "@vitest/runner"; // types: v4.0.14
import { VitestTestRunner } from "vitest/runners"; // types: v4.0.14
export default class Runner extends VitestTestRunner implements VitestRunner {}
// ^ Class 'Runner' incorrectly implements interface 'VitestRunner'.
// The types of 'config.name' are incompatible between these types.
// Type 'string | undefined' is not assignable to type 'string'.
// Type 'undefined' is not assignable to type 'string'.System Info
System:
OS: Linux 6.6 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
CPU: (16) x64 AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
Memory: 3.88 GB / 27.31 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 24.5.0 - /home/david/.nvm/versions/node/v24.5.0/bin/node
npm: 11.5.1 - /home/david/.nvm/versions/node/v24.5.0/bin/npm
bun: 1.2.4 - /home/david/.bun/bin/bun
Deno: 2.1.1 - /home/david/.deno/bin/deno
npmPackages:
@vitest/browser-playwright: ^4.0.13 => 4.0.13
@vitest/ui: ^4.0.13 => 4.0.13
vite: ^7.2.4 => 7.2.4
vitest: ^4.0.13 => 4.0.13Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
p2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pending triage
Type
Projects
Status
P2 - 3