article_spider icon indicating copy to clipboard operation
article_spider copied to clipboard

error TS2339: Property 'attribs' does not exist on type 'Element'.

Open gao-zhi-ustc opened this issue 3 years ago • 1 comments

article_spider % tsc src/wechat/parser.ts:207:29 - error TS2339: Property 'attribs' does not exist on type 'Element'. Property 'attribs' does not exist on type 'TextElement'.

207 const src = img.attribs['data-src'] || img.attribs['data-backsrc'] || img.attribs['src']; ~~~~~~~

src/wechat/parser.ts:207:56 - error TS2339: Property 'attribs' does not exist on type 'Element'. Property 'attribs' does not exist on type 'TextElement'.

207 const src = img.attribs['data-src'] || img.attribs['data-backsrc'] || img.attribs['src']; ~~~~~~~

src/wechat/parser.ts:207:87 - error TS2339: Property 'attribs' does not exist on type 'Element'. Property 'attribs' does not exist on type 'TextElement'.

207 const src = img.attribs['data-src'] || img.attribs['data-backsrc'] || img.attribs['src']; ~~~~~~~

src/wechat/parser.ts:208:30 - error TS2339: Property 'attribs' does not exist on type 'Element'. Property 'attribs' does not exist on type 'TextElement'.

208 const type = img.attribs['data-type'] || 'jpg'; ~~~~~~~

src/wechat/parser.ts:213:38 - error TS2339: Property 'attribs' does not exist on type 'Element'. Property 'attribs' does not exist on type 'TextElement'.

213 imagesMeta.push({ ...img.attribs }); ~~~~~~~

src/wechat/parser.ts:229:28 - error TS2339: Property 'tagName' does not exist on type 'TextElement | TagElement | CommentElement'. Property 'tagName' does not exist on type 'TextElement'.

229 img.parent.tagName === 'p' && (contentElement.find('p')[0] === img.parent)) { ~~~~~~~

typings/crawler.d.ts:9:16 - error TS2304: Cannot find name 'CheerioAPI'.

9 $: CheerioAPI; ~~~~~~~~~~

Found 7 errors.

gao-zhi-ustc avatar Mar 03 '21 02:03 gao-zhi-ustc

我也遇到了,正好7个错误

linzhk avatar Aug 17 '21 12:08 linzhk