We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
No response
包下面增加 type.d.ts 文件以支持 exports 导入的类型提示
The text was updated successfully, but these errors were encountered:
假设现在在 esm 目录有以下的 d.ts 产物:
esm ├── hooks.js ├── hooks.d.ts ├── request.js └── request.d.ts
并且我们明确知道这两个文件是需要被导出的:
{ "exports": { "./hooks": { "import": "./esm/hooks.js" }, "./request": { "import": "./esm/request.js" } } }
那么我们可以在根目录下新建两个 d.ts 文件:
├── hooks.d.ts ├── request.d.ts └── package.json
// hooks.d.ts export * from './esm/hooks';
这样在 import hooks from 'your-package-name/hooks'; 的时候编辑器就不会报错了
import hooks from 'your-package-name/hooks';
Sorry, something went wrong.
@luhc228 所以这个本质原因是 exports 里面声明的导出也需要有同名的 .d.ts 文件吗?
.d.ts
ClarkXia
Successfully merging a pull request may close this issue.
Summary | 概述
No response
Motivation | 背景
Usage example | 使用示例
No response
Detailed design | 方案设计
包下面增加 type.d.ts 文件以支持 exports 导入的类型提示
Additional context | 额外信息
No response
The text was updated successfully, but these errors were encountered: