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

The TypeScript typings have errors and make this library unusable from TypeScript #96

Closed
slikts opened this issue Feb 20, 2018 · 11 comments
Labels

Comments

@slikts
Copy link

slikts commented Feb 20, 2018

The TypeScript typings have errors that prevent code depending on this library from compiling in TypeScript; namely, the CheerioSelector and CheerioStatic types are missing definitions.

I'm not sure what the proper fix is; I made a fork that adds /// <reference path="../../../@types/cheerio/index.d.ts" /> to lib/index.d.ts so that the library would compile, but it seems like a 'hacky' workaround.

@IonicaBizau
Copy link
Owner

/cc'ing @andrewneo

@edorivai
Copy link
Contributor

edorivai commented Mar 6, 2018

For what it's worth, installing @types/cheerio let's me compile. Not sure how to define dependencies for @types.

@slikts
Copy link
Author

slikts commented Mar 6, 2018

Seems like it should be a peer dependency.

@edorivai
Copy link
Contributor

edorivai commented Mar 7, 2018

But isn't that kinda weird, because then non-TS users will get "missing peer dependency" warnings

@slikts
Copy link
Author

slikts commented Mar 7, 2018

Non-TS users can still benefit from TS typings; for example, VS Code TS type intelligence also works in JS files.

@edorivai
Copy link
Contributor

edorivai commented Mar 7, 2018

Hmm, good point 🤔 . Wouldn't that make a normal dependency a better fit then?

@IonicaBizau
Copy link
Owner

I merged #101. I'm wondering if this is still an issue. Can you check?

@edorivai
Copy link
Contributor

@IonicaBizau If I remember correctly, #101 was not meant to fix this issue. It arose from another change that just contained faulty TS.

@kpratik2015
Copy link

The TypeScript typings have errors that prevent code depending on this library from compiling in TypeScript; namely, the CheerioSelector and CheerioStatic types are missing definitions.

I'm not sure what the proper fix is; I made a fork that adds /// <reference path="../../../@types/cheerio/index.d.ts" /> to lib/index.d.ts so that the library would compile, but it seems like a 'hacky' workaround.

I had to put /// <reference path="../../../node_modules/@types/cheerio/index" />

@IonicaBizau
Copy link
Owner

Is this still a thing? I am not expert in TS, but I merged some related PRs.

@IonicaBizau
Copy link
Owner

Duplicate of #121

Moving the discussion there.

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

No branches or pull requests

4 participants