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

如何避免 mini-types 产生 namespace 混淆? #44

Open
Otto-J opened this issue May 7, 2024 · 1 comment
Open

如何避免 mini-types 产生 namespace 混淆? #44

Otto-J opened this issue May 7, 2024 · 1 comment
Assignees

Comments

@Otto-J
Copy link

Otto-J commented May 7, 2024

我目前在项目中还在延用 mini-types 作为类型提示,考虑到用的比较多,我想部分迁移到 @mini-types/alipay 来。我发现 @mini-types/alipay 的 namespace 没有 export ,现在点击 my 类型会有两个文件,我该如何同时混用两个包呢。

如果你这边给 namespace 做 export 导出,我是否可以重命名角 my2 或者 newMy 做过度使用呢?还请帮助我理清 类型的困惑

@Otto-J
Copy link
Author

Otto-J commented May 7, 2024

我测试了下,好像可以。
给 lib.my.d.ts 修改为 export declare namespace my {} ,我就可以 import type { my as my2 } from '@mini-types/my/types/lib.my' 这样我就可以使用 my2 进行类型推断了。

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

2 participants