Deprecate @types/flatbush - flatbush ships its own types in 4.2.0 (#65662)

* use flatbush builtin types now

* geoflatbush updates
This commit is contained in:
mfedderly
2023-06-05 20:16:50 -04:00
committed by GitHub
parent a8724de9b4
commit ae9dc47e7f
9 changed files with 14 additions and 140 deletions

View File

@@ -1805,6 +1805,10 @@
"libraryName": "fkill",
"asOfVersion": "6.0.0"
},
"flatbush": {
"libraryName": "flatbush",
"asOfVersion": "4.2.0"
},
"flatpickr": {
"libraryName": "flatpickr",
"asOfVersion": "3.1.2"

View File

@@ -1,11 +0,0 @@
import Flatbush = require('flatbush');
const from: Flatbush = Flatbush.from(new ArrayBuffer(0));
const index = new Flatbush(1);
// $ExpectType number
const addedIndex = index.add(0, 0, 1, 1);
index.finish();
const results = index.search(0.5, 0.5, 0.5, 0.5);
const neighbors = index.neighbors(0.5, 0.5);

View File

@@ -1,102 +0,0 @@
// Type definitions for flatbush 3.3
// Project: https://github.com/mourner/flatbush
// Definitions by: Matt Fedderly <https://github.com/mfedderly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
type TypedArrayConstructor =
| Int8ArrayConstructor
| Uint8ArrayConstructor
| Uint8ClampedArrayConstructor
| Int16ArrayConstructor
| Uint16ArrayConstructor
| Int32ArrayConstructor
| Uint32ArrayConstructor
| Float32ArrayConstructor
| Float64ArrayConstructor;
declare class FlatbushClass {
/**
* @param numItems total number of items to be indexed
* @param nodeSize size of the tree node, experiment with different values for best performance. Default 16.
* @param arrayType The array type used for coordinates storage. Other types may be faster in certain cases. Default Float64Array.
*/
constructor(numItems: number, nodeSize?: number, arrayType?: TypedArrayConstructor);
/**
* Adds a given rectangle to the index. Returns a zero-based, incremental number that represents the newly added rectangle.
*/
add(minX: number, minY: number, maxX: number, maxY: number): number;
/**
* Performs indexing of the added rectangles. Their number must match the one provided when creating a Flatbush object.
*/
finish(): void;
/**
* Returns an array of indices of items in a given bounding box.
*/
search(minX: number, minY: number, maxX: number, maxY: number, filter?: (idx: number) => boolean): number[];
/**
* Returns an array of item indices in order of distance from the given x, y (known as K nearest neighbors, or KNN).
*/
neighbors(
x: number,
y: number,
maxResults?: number,
maxDistance?: number,
filter?: (idx: number) => boolean
): number[];
/**
* Recreates a Flatbush index from raw ArrayBuffer data (that's exposed as index.data on a previously indexed Flatbush instance).
* Very useful for transferring indices between threads or storing them in a file.
*/
static from(data: ArrayBuffer): FlatbushClass;
/**
* array buffer that holds the index
*/
readonly data: ArrayBuffer;
/**
* bounding box of the data.
*/
readonly minX: number;
/**
* bounding box of the data.
*/
readonly minY: number;
/**
* bounding box of the data.
*/
readonly maxX: number;
/**
* bounding box of the data.
*/
readonly maxY: number;
/**
* number of stored items.
*/
readonly numItems: number;
/**
* number of items in a node tree.
*/
readonly nodeSize: number;
/**
* array type used for internal coordinates storage.
*/
readonly ArrayType: TypedArrayConstructor;
/**
* array type used for internal item indices storage.
*/
readonly IndexArrayType: TypedArrayConstructor;
}
declare namespace FlatbushClass {
type Flatbush = FlatbushClass;
}
export = FlatbushClass;

View File

@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"flatbush-tests.ts"
]
}

View File

@@ -1 +0,0 @@
{ "extends": "@definitelytyped/dtslint/dt.json" }

View File

@@ -1,4 +1,4 @@
import Flatbush = require('flatbush');
import Flatbush from 'flatbush';
import { around } from 'geoflatbush';
const index = new Flatbush(1);

View File

@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import { Flatbush } from 'flatbush';
import Flatbush from 'flatbush';
/**
* Performs nearest neighbors queries for geographic bounding boxes, taking Earth curvature and date line wrapping into account.

View File

@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"flatbush": "^4.2.0"
}
}

View File

@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"ES2017"
],
"noImplicitAny": true,
"noImplicitThis": true,