Skip to content

Incorrect type definitions for search #198

Closed

Description

@arun-mani-j

Documentation for search says search takes an option string as second argument. However, the TS definition says the second argument is max_hits.

❯ pnpm why mupdf
mupdf@1.28.0
└── foo (dependencies)

Found 1 version of mupdf

❯ grep -n "search" node_modules/mupdf/dist/mupdf.d.ts
213:    search(needle: string, max_hits?: number): Quad[][];
271:    search(needle: string, max_hits?: number): Quad[][];
457:    search(needle: string, max_hits?: number): Quad[][];

Activity

  1. arun-mani-j commented on Sep 6, 2026

    @arun-mani-j
    ContributorAuthor

    It seems even the shipped code treats the second argument as max_hits only 🤔

    > d = Document.openDocument("unicode.pdf")
    [PDFDocument 7075864]
    > p = d.loadPage(0)
    [PDFPage 7357224]
    > p.search("Python").length
    6
    > p.search("Python", 2).length
    2
  2. artifex-tor commented on Sep 6, 2026

    @artifex-tor

    A bug in 1.28.0. Upgrade to 1.28.1.

  3. arun-mani-j commented on Sep 6, 2026

    @arun-mani-j
    ContributorAuthor

    Is 1.28.1 available at npm yet?

  4. artifex-tor commented on Sep 6, 2026

    @artifex-tor

    It is now!

  5. arun-mani-j commented on Sep 6, 2026

    @arun-mani-j
    ContributorAuthor
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions