mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 06:40:35 +08:00
.html() can return null
.html() can return null when querying an element that does not exist.
Repro:
const response = await axios.default.get('https://www.google.com/')
const $ = cheerio.load(response.data)
const foo = $('.bar').html()
console.log(`foo is: ${foo}`) //foo is: null
This commit is contained in:
2
types/cheerio/index.d.ts
vendored
2
types/cheerio/index.d.ts
vendored
@@ -172,7 +172,7 @@ interface Cheerio {
|
||||
|
||||
empty(): Cheerio;
|
||||
|
||||
html(): string;
|
||||
html(): string | null;
|
||||
html(html: string): Cheerio;
|
||||
|
||||
text(): string;
|
||||
|
||||
Reference in New Issue
Block a user