[英]How to forward a TSDoc description within an object property
For example, I have a function:例如,我有一个 function:
/**
* Function returns null
*/
const myFunction = () => {
return null
}
And an object like this:还有一个像这样的 object:
const internals = {
myFunction: myFunction,
}
So I want to see this description: "Function returns null" at internals.myFunction
in VScode.所以我想在 VScode 的internals.myFunction
中看到这个描述:“函数返回 null”。
But with notations like @inheritDoc, @link and such I just see them as is: {@inheritDoc myFunction}
但是对于像@inheritDoc、@link 之类的符号,我只是按原样看待它们: {@inheritDoc myFunction}
I want to generate a solid d.ts
with all necessary docs我想用所有必要的文档生成一个可靠的d.ts
Is it possible?可能吗?
So I had a glance at React sources and there is the way:所以我看了一下 React 的源代码,有办法:
Let assume the function is in a file my-function.ts
:假设 function 在文件my-function.ts
中:
/**
* Function returns null
*/
export const myFunction = () => {
return null
}
then I reexport all my functions like this:然后我重新导出我的所有函数,如下所示:
functions.ts
: functions.ts
:
import {myFunction} from './my-function'
import {myFunction2} from './my-function2'
// and other imports
export {
myFunction,
myFunction2,
}
And finally:最后:
internals.ts
import * as functions from './functions'
const internals = {
functions,
}
So by this way I finally can see "Function returns null" at所以通过这种方式,我终于可以在
internals.functions.myFunction
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.