次のコードを使用して、入力 DOM オブジェクト自体を含む入力に関する情報を配列に格納しようとしています。
export class SelectionOtherInputDescriptor {
constructor(public selectionName: string, public otherKey: any, public otherInputElement: HTMLInputElement) { }
}
export class SelectionOtherInputHelper {
selectionsWithOther: { [selectionKey: string]: SelectionOtherInputDescriptor; } = {};
getAllSelectionOthers() {
var things = $("[" + ATT_SELECTION_OTHER_FOR + "]");
for (var i = 0; i < things.length; i++) {
var selectionName = $(things[i]).attr(ATT_SELECTION_OTHER_FOR);
var desc = new SelectionOtherInputDescriptor(selectionName, 0, $(things[i]));
this.selectionsWithOther[selectionName] = desc;
};
};
}
オンラインで
var desc = new SelectionOtherInputDescriptor(selectionName, 0, $(things[i]));
コンパイルエラーが発生します:
タイプ 'JQuery' に
setSelectionRange
タイプ 'HTMLInputElement' のプロパティがありません
SelectionOtherInputDescriptor
自分のオブジェクトでやりたいことは配列内のオブジェクトに格納することだけ なのに、HTMLInputElement
パラメーターにプロパティが必要なのはなぜですか。setSelectionRange