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

按照文档typescript项目引入,在没有导入alova,是类型推断会标红 #360

Closed
Nowork-wen opened this issue May 11, 2024 · 3 comments
Labels
bug:need-confirm It's probably a bug vue Issues or pull request for vue

Comments

@Nowork-wen
Copy link

请详细描述bug

封装了AlovaInstance是咧,然后再请求的接口封装闻文件中使用
如下图
Snipaste_2024-05-11_17-25-47
但是只要引入alova,飘红就会没有(不管引入的是啥,只要引入alova,就不会报错)

复现链接

No response

复现步骤

如上图片,放开注释和解开注释,就能复现此问题

期望的表现

帮忙看看是啥原因

alova 版本

2.20.3

设备/浏览器/浏览器版本

在webstorm编辑器,2024.1版本

额外的说明

Snipaste_2024-05-11_17-25-47
Snipaste_2024-05-11_17-30-01

@Nowork-wen Nowork-wen added bug:need-confirm It's probably a bug vue Issues or pull request for vue labels May 11, 2024
@Nowork-wen
Copy link
Author

报错内容:The inferred type of getMonitor cannot be named without a reference to .pnpm/[email protected]/node_modules/alova. This is likely not portable. A type annotation is necessary.

@MeetinaXD
Copy link
Contributor

你好,这个问题这边似乎没法复现,请提供更多的信息如:typescript版本等。

建议你这边提供一个可以复现问题的最小项目,托管到codepen这类平台上,方便我们更快定位,感谢!

@Nowork-wen
Copy link
Author

不好意思,根据您的反馈,我检查了一下编辑器的typescript版本,是因为版本太低的原因造成的,更新以后不会在报错了,感觉您的回答,谢谢!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:need-confirm It's probably a bug vue Issues or pull request for vue
Projects
None yet
Development

No branches or pull requests

2 participants