Consider owning @types/cheerio type definitions
See original GitHub issueProblem
In the early days, jQuery familiarity was one of the main attractions to Cheerio. Nowadays it may be more of a hindrence.
For example, it’s confusing that Cheerio’s $(selector).each(fn)
has a different argument order than ES5’s forEach
.
const fruits = [];
$('li').each(function(i, elem) {
fruits[i] = $(this).text();
});
fruits.join(', ');
//=> Apple, Orange, Pear
Potential Solution
One way to reduce the friction is to have autocomplete. We currently support some autocomplete via JSDoc but the type definitions would take it a step further.
Some wonderful folks have been maintaining @types/cheerio. Installing this extra package is quite obvious for Typescript users but less obvious for Javascript developers.
We could make this simpler by hosting those types within the Cheerio repository. This would be one less thing to install and the type definitions would get picked up for Javascript users.
Downsides
- The maintenance burden is now on the Cheerio maintainers.
- Any other downsides?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (7 by maintainers)
Top GitHub Comments
Fixed in #1491
I suppose we should hold off on deprecating the DT types until the 1.0.0 release is made.