将 Node 模块 Cheerio 从 0.22.0 更新到 1.0.0-rc.12 后,出现以下错误
Object literal may only specify known properties, and 'normalizeWhitespace' does not exist in type 'CheerioOptions'.
normalizeWhitespace: true,
代码:
const $ = load(html, {
decodeEntities: true,
normalizeWhitespace: true,
});
如果我删除该选项,行为会发生变化,但我找不到应该使用哪个选项。
我有节点 v18
CheerioParserOptions
:
import * as cheerio from 'cheerio';
const html = '<h2 class="title">Hello world</h2>';
const opts: cheerio.CheerioParserOptions = {
decodeEntities: true,
normalizeWhitespace: true,
}
const $ = cheerio.load(html, opts);