-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Typings issues with exactOptionalPropertyTypes and Disposable #9854
Copy link
Copy link
Labels
p2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pending triage
Description
Describe the bug
When I set in tsconfig.json: "skipLibCheck": false and "exactOptionalPropertyTypes": true,
Get compiler issues
node_modules/@vitest/runner/dist/tasks.d-D2GKpdwQ.d.ts:1407:11 - error TS2430: Interface 'FailureScreenshotArtifactAttachment' incorrectly extends interface 'TestAttachment'.
Types of property 'body' are incompatible.
Type 'undefined' is not assignable to type 'string | Uint8Array<ArrayBufferLike>'.
1407 interface FailureScreenshotArtifactAttachment extends TestAttachment {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@vitest/runner/dist/tasks.d-D2GKpdwQ.d.ts:1418:11 - error TS2430: Interface 'FailureScreenshotArtifact' incorrectly extends interface 'TestArtifactBase'.
Types of property 'attachments' are incompatible.
Type '[FailureScreenshotArtifactAttachment] | []' is not assignable to type 'TestAttachment[]'.
Type '[FailureScreenshotArtifactAttachment]' is not assignable to type 'TestAttachment[]'.
Type 'FailureScreenshotArtifactAttachment' is not assignable to type 'TestAttachment' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'body' are incompatible.
Type 'undefined' is not assignable to type 'string | Uint8Array<ArrayBufferLike>'.
1418 interface FailureScreenshotArtifact extends TestArtifactBase {
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@vitest/spy/dist/index.d.ts:158:81 - error TS2304: Cannot find name 'Disposable'.
158 interface MockInstance<T extends Procedure | Constructable = Procedure> extends Disposable {
~~~~~~~~~~
node_modules/vitest/dist/index.d.ts:357:83 - error TS2304: Cannot find name 'Disposable'.
357 doMock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): Disposable;
~~~~~~~~~~
node_modules/vitest/dist/index.d.ts:358:95 - error TS2304: Cannot find name 'Disposable'.
358 doMock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): Disposable;
~~~~~~~~~~
Found 5 errors.
Disposable issue can be fixed by switch to ESNext, however, it's a questionable fix...
Reproduction
System Info
System:
OS: Windows 11 10.0.26200
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Memory: 4.23 GB / 31.86 GB
Binaries:
Node: 25.4.0 - C:\nvm4w\nodejs\node.EXE
npm: 11.7.0 - C:\nvm4w\nodejs\npm.CMD
Browsers:
Chrome: 145.0.7632.117
Edge: Chromium (140.0.3485.54)
Firefox: 138.0.1 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
@vitest/coverage-v8: latest => 4.1.0
vitest: latest => 4.1.0Used 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pending triage
Type
Projects
Status
P2 - 2