有什么类似于在 Typescript 或 JavaScript 中使用的 @VisibleForTesting 注释吗?

Avi*_*pta 9 javascript java testing node.js typescript

Java 中通过 Google Guava 库提供了一个@VisibleForTesting注释,表明类型或成员的可见性已放宽,以使代码可测试:注释使私有方法仅对测试类公开。随后还有一些插件可确保注释的方法@VisibleForTesting实际上仅在测试类中使用。

我目前有一个打字稿界面,我必须在界面中添加一些方法以用于测试目的。例如:

interface ProcessorInterface {
  process(data: Readonly<Data>): Promise<Result>;

  // these 2 methods are only added here so that they are 
  // callable from the implementation while writing tests.
  processBatch(data: Readonly<Data>): Promise<Result>;
  validate(data: Readonly<Data>): Promise<Error[]>;
}
Run Code Online (Sandbox Code Playgroud)

我想知道 Typescript 中是否有标准方法来表示相同的内容。

任何帮助,将不胜感激。谢谢。