Having trouble with Javascript code inside typescript.
$.fn.select2.amd.require([
'select2/data/array',
'select2/utils'
], function (ArrayData, Utils) {
/* tslint:disable */
function CustomData ($element, options) :any {
CustomData.__super__.constructor.call(this, $element, options);
}
/* tslint:enable */
Utils.Extend(CustomData, ArrayData);
CustomData.prototype.query = function (params, callback) {
var result = ymaps.suggest(params.term).then(function (items) {
var data = [];
var output = {
results : [],
more : false
};
for (var index = 0; index < items.length; ++index) {
data.push({
id: String(items[index]['displayName']),
text: items[index]['displayName'],
})
}
output.results = data;
callback(output);
});
};
$("#basic").select2({
width:"100%",
closeOnSelect:false,
dataAdapter: CustomData
});
$('#basic').on('select2:select', function (e) {
console.log(e);
$('span.select2-search.select2-search--dropdown > input').val($("#basic").val());
});
});
An error occurs when running ng build:
ERROR in src/app/car/car-create/car.component.ts(43,28): error TS2339: Property '__super__' does not exist on type '($element: any, options: any) => any'.
Looking for a solution to this issue. Tried declaring var CustomData: any; and adding /* tslint:disable */ before the class export line.