Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS2694: Namespace '/node_modules/.pnpm/[email protected]/node_modules/cheerio/dist/esm/index' has no exported member Element #3988

Open
cdwmhcc opened this issue Aug 11, 2024 · 0 comments

Comments

@cdwmhcc
Copy link

cdwmhcc commented Aug 11, 2024

Description

After upgrading from rc to 1.0.0, cheerio.Element is no longer valid. Now need to manually install domhandler and then import Element from domhandler

Example

Here's an example where the issue becomes apparent:

import * as cheerio from 'cheerio'

const $ = cheerio.load('<ul><li>hello</li></ul>')

// Type Element is missing the following properties from type Element:
// classList, className, clientHeight, clientLeft
// , and 157 more.
const ul: cheerio.Cheerio<Element> = $('ul')
test(ul)
function test(elements: cheerio.Cheerio<Element>) {}

pnpm i domhandler

import type { Element } from 'domhandler'
import * as cheerio from 'cheerio'

....

It works.

Suggested Solutions

It would be beneficial for developers if Cheerio could re-export the commonly used types from domhandler, such as Element. This would streamline the development process by reducing the need for additional imports and clarifying the source of types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant