属性' getType'类型不存在

发布于 2025-01-26 19:43:16 字数 423 浏览 3 评论 0原文

我正在从Angular 12升级到Angular 13-构建时,我在终端中遇到了一些错误,

Error: src/app/components/feeds/replies/reply.ts:81:31 - error TS2339: Property 'getType' does not exist on type 'typeof import("/Users/me/Sites/app-ng/node_modules/@types/mime/index")'.

81         const mimeType = mime.getType(item) || '';

我已经检查了代码,并且在Mime类中确实存在getType(我可以控制单击文件中的单击并打开它相关文件罚款) - 任何人都知道为什么会发生此错误以及我如何修复它?

I am upgrading from Angular 12 to Angular 13 - when building I get some errors in the terminal

Error: src/app/components/feeds/replies/reply.ts:81:31 - error TS2339: Property 'getType' does not exist on type 'typeof import("/Users/me/Sites/app-ng/node_modules/@types/mime/index")'.

81         const mimeType = mime.getType(item) || '';

I have checked the code and the getType does exist on mime class (I can control click in the file and it opens the relevant file fine) - anyone know why this error occurs and how I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橪书 2025-02-02 19:43:16

MIME(2.x和3.x)的先前版本依赖于外部类型的定义(@type/mime),并且存在/存在定义问题。

来自 4.0.0 内置了ts支持,现在消失了。

所以公正

npm i mime@latest

并继续。

Previous versions of Mime (2.x and 3.x) rely on external type definitions (@types/mime) and there were/are issues with the definitions.

From 4.0.0 onward TS support is built-in and this issue is now gone.

So just

npm i mime@latest

and carry on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文