我一直在使用Basarats的優秀Collections庫小幅更新的0.9.0創建類型,如:的typedef就像C/C++
Dictionary<ControlEventType,
Dictionary<number, (sender: IControl,
eventType: ControlEventType,
order: ControlEventOrder,
data: any) => void >>
現在我不希望有完整的每一個寫這篇我使用它的時間。其中一個似乎工作的方法之一是:
export class MapEventType2Handler extends C.Dictionary<ControlEventType,
C.Dictionary<number,
(sender: IControl,
eventType: ControlEventType,
order: ControlEventOrder,
data: any) => void >> {}
然後我就可以寫:的
EH2: MapEventType2Handler = new MapEventType2Handler();
代替:
EH: Dictionary<ControlEventType,
Dictionary<number,
(sender: IControl,
eventType: ControlEventType,
order: ControlEventOrder,
data: any) => void >>;
人碰到更好的想法?
我也正在試驗'typedeffing'各種功能簽名沒有很好的結果。
不再是正確的 - 現在有一個辦法,所以這需要更新。 ;) –