Skip to content

Bug: mergeSingleEvent() missing return statements #147

@grimmdude

Description

@grimmdude

Description

mergeSingleEvent() in src/chunks/track.ts declares a return type of Track but has two code paths with missing/incorrect returns:

  1. Line 175 — early return has no value (return; instead of return this;)
  2. End of function (~line 210) — no return statement at all
mergeSingleEvent(event: AbstractEvent): Track {
    if (!this.events.length) {
        this.addEvent(event);
        return;  // returns undefined, not this
    }
    // ... rest of function ...
    // no return statement
}

Impact

Violates the Track return type contract. Any code attempting to chain off mergeSingleEvent() would get undefined.

Suggested Fix

Add return this; to both code paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions