【发布时间】:2022-12-02 05:06:59
【问题描述】:
when I use cheerio in my project with typescript, and try to compile it by tsc. The compiler throws an exception described below:
error TS2307: Cannot find module '.' or its corresponding type declarations.
2 import type { CheerioAPI, Cheerio } from '.';
Found 1 error in node_modules/cheerio/lib/esm/static.d.ts:2
This seems to be a bug in the package itself. How should I solve this problem? Thanks.
And I only use cheerio in my project like this:
import * as cheerio from "cheerio";
cheerio.load(content) // The type of content is string.
"cheerio": "^1.0.0-rc.12""@types/cheerio": "^0.22.31"node v16.16.0npm v8.16.0
【问题讨论】:
-
Are you sure it's okay to import v0 of the types for v1 of the cheerio package? See how-do-definitely-typed-package-versions-relate-to-versions-of-the-corresponding-library?
标签: node.js typescript npm es6-modules cheerio