Skip to content

static text() method is not actually exported #2402

@Hashbrown777

Description

@Hashbrown777

As mentioned in the README:

You may also render the text content of a Cheerio object using the text static method:

const $ = cheerio.load('This is <em>content</em>.');
cheerio.text($('body'));
//=> This is content.

Yet neither index.d.ts nor index.js actually forwards text from lib/static.{d.ts,js} (it appears to re-export methods one-by-one for some reason, and misses text).

image

As a workaround I tried importing static directly, but it doesnt like it.

image

Using import {text} from 'cheerio/lib/static' gets past typescript complaints, but for some reason doesn't transpile to mjs well.

image

So [at least in typescript targeting ES2020 using modules] it's impossible to use the text static method.

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