【发布时间】:2015-11-05 10:28:23
【问题描述】:
我有一个类如下(仅展示部分):
export class LinkedListNode<t> extends windward.WrObject implements ILinkedListNode<t>{
public get next():LinkedListNode<t> {
return this._next === this._list._first ? null : this._next;
}
}
所以在接口中我想将 next 声明为一个方法。但是,以下方法不起作用:
export interface ILinkedListNode<t> {
get next() : LinkedListNode<t>;
}
以下确实有效,但不准确:
export interface ILinkedListNode<t> {
next : LinkedListNode<t>;
}
有没有办法在接口中声明一个getter? getter 与成员变量不同,例如,在发布对象时它不会传递给 web worker。
谢谢 - 戴夫
【问题讨论】: