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

模块暴露出错 #30

Open
chen-ziwen opened this issue Jul 21, 2024 · 4 comments
Open

模块暴露出错 #30

chen-ziwen opened this issue Jul 21, 2024 · 4 comments

Comments

@chen-ziwen
Copy link

源码暴露使用 exports.default = Client;
导入的时候使用 import alimt20181012, * as $alimt20181012 from '@alicloud/alimt20181012';
然后案例中把alimt20181012当成类去使用,但是它实际上是一个模块对象,alimt20181012.default才是真正的类,现在问题就是typescript识别不到alimt20181012.default,它把alimt20181012当成了类。

@wangerzi
Copy link

碰到了同样的问题,非常奇葩

@wangerzi
Copy link

这里是用 @alicloud/green20220302 发现的

@raylax
Copy link

raylax commented Oct 10, 2024

@alicloud/dysmsapi20170525 也有这个问题
应该是构建目标为cjs的问题吧

暂时这样解决的

import dysmsapi from '@alicloud/dysmsapi20170525'
// @ts-ignore
const Client = dysmsapi.default as typeof dysmsapi
const client = new Client()

@chen-ziwen
Copy link
Author

反馈了 但是官方没有积极去修改 后面通过@ts-ignore忽略掉ts类型

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

3 participants