DefinitelyTyped/types/rbush/rbush-tests.ts
Zbigniew Zagórski 392315758c Update typings for rbush v3.0 (#39315)
* Move old typings to v2/, add v3 typings

* Fix npm-naming linting error.
2019-10-24 10:45:04 -07:00

38 lines
598 B
TypeScript

import RBush, { BBox } from 'rbush';
interface IndexedRect extends BBox {
index: number;
}
function test_rbush() {
const index = new RBush<IndexedRect>();
index.clear().insert({
minX: 0,
minY: 0,
maxX: 10,
maxY: 10,
index: 0,
});
index.all();
index.fromJSON(index.toJSON());
index.search({
minX: 5,
maxX: 15,
minY: 5,
maxY: 11,
});
index.load([
{
minX: 0,
minY: 0,
maxX: 10,
maxY: 10,
index: 0,
},
]);
}