ᆼᆺᆼ*_*ᆼᆺᆼ 2 javascript jsdoc tsdoc
我想将一个属性(例如qux下面的)标记为已弃用:
/**
@typedef {object} Foo
@property {string} bar
@property {symbol} qux - How to deprecate it?
@deprecated @property {symbol} qux2 - Doesn't work
@property {symbol} qux3 @deprecated - This marks the whole of Foo as deprecated
*/
Run Code Online (Sandbox Code Playgroud)
我应该提到,我想在 JSDoc 注释中执行此操作,而不是使用 TypeScript。
根据tsdoc 上的Issue#131@deprecated ,您实际上可以使用属性,只需将其设置在对象内部(也适用于 JS)。
例如:
/**
* Explain the interface ...
*/
export interface test {
/**
* Foo property
*/
Foo: string;
/**
* @deprecated Use {@link test.qux2} instead.
*/
qux: string;
/**
* qux2 property
*/
qux2: string;
}
Run Code Online (Sandbox Code Playgroud)
结果是:
在课程中,例如:
/**
* Explain the interface ...
*/
export interface test {
/**
* Foo property
*/
Foo: string;
/**
* @deprecated Use {@link test.qux2} instead.
*/
qux: string;
/**
* qux2 property
*/
qux2: string;
}
Run Code Online (Sandbox Code Playgroud)
结果:
| 归档时间: |
|
| 查看次数: |
3571 次 |
| 最近记录: |