Skip to content

Commit fb0fcfd

Browse files
committed
Work around TS stupidity (#455)
1 parent a7a8a3d commit fb0fcfd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/src/semantic-search/dropdown-view.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SubViewDescription } from 'backbone-fractal/dist/composite-view';
33
import 'select2';
44

55
import Model from '../core/model';
6+
import Collection from '../core/collection';
67
import View, { CompositeView, CollectionView } from '../core/view';
78
import { xsd, rdfs } from '../common-rdf/ns';
89
import ldChannel from '../common-rdf/radio';
@@ -102,7 +103,14 @@ export default class Dropdown extends CompositeView {
102103
const criterion = applicableTo(range.id);
103104
this.filterGroup = new OptionGroup({
104105
model: groupLabels.get('filter'),
105-
collection: new FilteredCollection(filters, criterion),
106+
// For some reason, TS decided to reinterpret
107+
// `FilteredCollection`'s first parameter type as
108+
// `Backbone.Collection<Model> and `filters` as a
109+
// `Collection<Backbone.Model>`, which gave a lot of trouble.
110+
// While there is no reason for TS to make these inferences in
111+
// the first place, reaffirming that `filters` is a regular
112+
// `Collection<Model>` does solve the issue. Damn you TS!
113+
collection: new FilteredCollection(filters as Collection, criterion),
106114
});
107115
const predicates = applicablePredicates(range);
108116
this.listenTo(predicates, 'update', this.restoreSelection);

0 commit comments

Comments
 (0)