【发布时间】:2017-11-11 22:32:03
【问题描述】:
我在 Typescript 中启用了 checkJS 和 allowJS 并创建了一个简单的 fooInterface.d.ts 文件:
declare interface FooInterface {
x();
}
我正在尝试针对此接口对 JS 文件进行类型检查:
/**
* @implements {FooInterface}
*/
class Bar {
y() {}
}
但是我无法让它在运行 tsc 时引发错误。
也试过简单写declare class,也没用。
如何在 JSDoc+JS 中重用 .d.ts 文件中的类型?
【问题讨论】:
-
我认为
@implements还没有工作,但在跟踪它时存在问题。试试@extends -
在哪里可以找到问题?我试图在问题跟踪器中搜索这个没有结果。
@type + declare class无效,@extends + declare class无效:/
标签: javascript typescript jsdoc