Skip to content

TypeError: Cannot read properties of null (reading 'signal') #9371

Description

@ThibautMarechal

Describe the bug

Since this recent changes, if the third option provided to addEventListener is null, this throw in the vitest patch of addEventListener.

I know typescript isn't happy with null as a thrid parameter, but one of my dependency wich is no longer under maintenance set it as null😅

Reproduction

window.addEventListener('resize', console.log, null)

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 20.08 GB / 63.73 GB
  Binaries:
    Node: 24.11.1 - ~\AppData\Local\pnpm\node.EXE
    Yarn: 1.22.22 - ~\AppData\Local\pnpm\yarn.CMD
    npm: 11.6.2 - ~\AppData\Local\pnpm\npm.CMD
    pnpm: 10.8.1 - ~\AppData\Local\pnpm\pnpm.EXE
    bun: 1.2.19 - ~\AppData\Local\pnpm\bun.CMD
  Browsers:
    Edge: Chromium (140.0.3485.66)
    Internet Explorer: 11.0.26100.188

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions