Rush Stack商店博客活动
跳至主要内容

ae-unresolved-inheritdoc-base

"`{@inheritDoc}` 标签需要一个 TSDoc 声明引用;签名匹配目前尚不支持"

备注

假设我们有一些像这样的声明

export class Base {
/**
* Some documentation that we want to inherit
*/
public member(): void {}
}

export interface IChild {
/**
* Some documentation that we want to inherit
*/
value: string;
}

...然后我们尝试像这样继承它们的文档

export class Child extends Base implements IChild {
/** {@inheritDoc} */ // <-- not supported
public member(): void {}

/** {@inheritDoc} */ // <-- not supported
public value: string = 'example';
}

// Warning: The @inheritDoc tag needs a TSDoc declaration reference;
// signature matching is not supported yet

如果 `{@inheritDoc}` 标签可以与基类或接口中的对应成员匹配,那将很方便。这可能在将来实现;但是,目前不支持。相反,你需要提供一个显式的声明引用,像这样

export class Child extends Base implements IChild {
/** {@inheritDoc Base.member} */
public member(): void {}

/** {@inheritDoc IChild.value} */
public value: string = 'example';
}

如何修复

向 `{@inheritDoc}` 标签添加一个显式声明引用。

另请参阅