在JSDOC @TyPedef中使用导入类型
我正在尝试减少重复,以指定我的导入类型如下,但是我遇到了一个错误,
/**
@typedef {import("../types/util")} util
@typedef {util.mapBehaviors} mapBehaviors
... lots of other typedefs based on util
*/
'util' only refers to a type, but is being used as a namespace here.
这很奇怪,因为显式扩展导入的工作:
/**
@typedef {import("../types/util").mapBehaviors} mapBehaviors
... lots of other typedefs
*/
如何使用@typedef
与导入的别名使用?
I'm trying to reduce duplication in specifying my imported types as follows but I'm getting an error
/**
@typedef {import("../types/util")} util
@typedef {util.mapBehaviors} mapBehaviors
... lots of other typedefs based on util
*/
'util' only refers to a type, but is being used as a namespace here.
It's weird because expanding the import explicitly works:
/**
@typedef {import("../types/util").mapBehaviors} mapBehaviors
... lots of other typedefs
*/
How can I use @typedef
with an alias of an import?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您仅导出
接口
或type
来自.d.d.ts
文件而不是function> function>函数
或const
。这将起作用:
但是只有在
util.d.ts
中
This can happen if you are only exporting
interface
ortype
from your.d.ts
file and notfunction
orconst
.This will work:
but only if in
util.d.ts
you haveinstead of