Skip to content

Fix Cheerio type error after upgrading to v1.1.2 - #17

Draft
joshspicer with Copilot wants to merge 2 commits into
mainfrom
copilot/update-copilot-instructions
Draft

Fix Cheerio type error after upgrading to v1.1.2#17
joshspicer with Copilot wants to merge 2 commits into
mainfrom
copilot/update-copilot-instructions

Conversation

Copilot AI commented Oct 17, 2025

Copy link
Copy Markdown

This PR fixes a TypeScript compilation error introduced after upgrading Cheerio to v1.1.2 (#11).

Problem

The Cheerio<T> type in Cheerio v1.x is now a generic class that requires a type parameter, but the codebase was using the old API without providing one:

function createHtmlTopicResourceLinks($: cheerio.CheerioAPI, topicElements: cheerio.Cheerio): ResourceLink[] {
  // ...
}

This resulted in the following build error:

error TS2314: Generic type 'Cheerio<T>' requires 1 type argument(s).

Solution

Updated the type annotation to include the required generic parameter by:

  1. Importing AnyNode type from the domhandler package (which is already a dependency of Cheerio)
  2. Updating the function signature to use cheerio.Cheerio<AnyNode>
import type { AnyNode } from 'domhandler';

function createHtmlTopicResourceLinks($: cheerio.CheerioAPI, topicElements: cheerio.Cheerio<AnyNode>): ResourceLink[] {
  // ...
}

Testing

  • ✅ TypeScript compilation succeeds
  • ✅ All existing tests pass
  • ✅ Server starts and initializes correctly
  • ✅ No functional changes, only type annotation fix
Original prompt

test

The user has attached the following files as relevant context:

  • .github/copilot-instructions.md

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Copilot instructions document Fix Cheerio type error after upgrading to v1.1.2 Oct 17, 2025
Copilot AI requested a review from joshspicer October 17, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants