Visitar URL original
Event matched result - Not returning array of strings · Issue #2265 · remy/nodemon · GitHub
Skip to content

Event matched result - Not returning array of strings #2265

Closed

Description

@GARii
  • Versions: node 22.21.1
  • nodemon -v: 3.1.11
  • Operating system/terminal environment (powershell, gitshell, etc):
  • Using Docker? What image: No
  • Command you ran: src/scripts

Expected behaviour

While using nodemon, expecting here - event?.matched?.result, to return array of strings (path), where changes been made.
Event is of type NodemonEventRestart

Actual behaviour

For some reason, getting back - array of strings (paths) as a part of event and event?.matched?.result = undefined

Steps to reproduce

`nodemon({ script: '', ext: 'tsx,ts,json',   exec: 'echo "\n"', ignore: ['dist/**'] }); `

nodemon.on('restart', (event) => { console.log('Event', event, event?.matched?.result) }

Output - Event [ 'src/some_path.tsx'] undefined

Activity

  1. remy commented on Feb 18, 2026

    @remy
    Owner

    Why are you expecting a matched property in the array? ref: https://github.com/remy/nodemon/wiki/Events#states

  2. remy commented on Feb 19, 2026

    @remy
    Owner

    okay, I think I've figured out what you're doing. The TypeScript definition is wrong (I can't remember who wrote them, but it was before I was forced to climb onto the wagon, so now I can actually read and verify). I'm guessing something like copilot has auto-suggested those lines of code, which explains the syntax (from the TS definitions).

    I'm going to push a change that fixes the definitions, but for your benefit, the event only takes a string as the argument (or undefined), ie. on(event: 'restart', listener: (files?: string[]) => void): Nodemon;

  3. added a commit that references this issue on Feb 20, 2026
    5c03715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infonot enough information in issue to debug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions