1
:私のコンポーネントインテリセンスのいずれにおいてもアレイプロトタイプ活字体
export interface Func<T, TResult> {
(item: T): TResult;
}
declare global {
interface Array<T> {
where(predicate: Func<T, boolean>): Array<T>;
single(predicate: Func<T, boolean>): T;
first(predicate: Func<T, boolean>): T;
take(predicate: Func<T, boolean>, count: number): Array<T>;
countWhere(predicate: Func<T, boolean>): number;
count(): number;
}
}
Array.prototype.count = function <T>(): number {
return this.length;
}
//others
は拡張として私にこれらのメソッドを示しますが、私は例えば、未定義の取得デバッグ時:
events: Event[];
var result = this.events.count();
どのコンポーネントからでも表示できるように、Arrayメソッドを実装する必要がありますか?ここで
関連:http://stackoverflow.com/a/14034242/215552 –
実際にデバッグされたプロジェクトにこれらのメソッドを作成するモジュールをロードしましたか? – Bergi
それは異なった.tsファイルです私は使用されたコンポーネントのこのファイルをexportemしました – miechooy