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

cheerio module error. #88

Closed
sonygod opened this issue Apr 27, 2021 · 2 comments
Closed

cheerio module error. #88

sonygod opened this issue Apr 27, 2021 · 2 comments

Comments

@sonygod
Copy link

sonygod commented Apr 27, 2021

npx dts2hx cheerio
> Converting module cheerio
> Error: [TypeScript 3.7] Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig. (C:/projects/youtubeipfs/node_modules/cheerio/types/index.d.ts:278:22)
> Error: [TypeScript 3.7] String literal expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:10)
> Error: [TypeScript 3.7] Cannot find name 'DomUtils'. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:13)
> Error: [TypeScript 3.7] Cannot find name 'from'. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:22)
> Error: [TypeScript 3.7] 'from' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:10)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:13)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:22)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:27)
> Saved externs for cheerio into .haxelib/cheerio/1,0,0-rc,6/
> Converting module domhandler
> Saved externs for domhandler into .haxelib/domhandler/4,2,0/
> Converting module htmlparser2
> Error: [TypeScript 3.7] String literal expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:10)
> Error: [TypeScript 3.7] Cannot find name 'DomUtils'. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:13)
> Error: [TypeScript 3.7] Cannot find name 'from'. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:22)
> Error: [TypeScript 3.7] 'from' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:10)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:13)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:22)
> Error: [TypeScript 3.7] ';' expected. (C:/projects/youtubeipfs/node_modules/htmlparser2/lib/index.d.ts:36:27)
> Saved externs for htmlparser2 into .haxelib/htmlparser2/6,1,0/
> Converting module domelementtype
> Saved externs for domelementtype into .haxelib/domelementtype/2,2,0/
``




these is no function 


  ` load()`



```haxe

@:jsRequire("cheerio") extern class Cheerio {
	static var value(get, never) : cheerio.CheerioAPI;
	static inline function get_value():cheerio.CheerioAPI return cast Cheerio;

	//where is load function?
   
}

`var $ = cheerio.load(iconv.decode(body, PAGE_ENCODING));`
``
@haxiomic
Copy link
Owner

load() is inside CheerioAPI: use it like Cheerio.value.load(...)

I agree this isn't intuitive, this will improve when module-level-fields for externs are fully complete (maybe haxe 4.3)

@haxiomic
Copy link
Owner

I've opened an issue to track that progress #89 so I will close this one

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

No branches or pull requests

2 participants