From ae9dc47e7fc1ebd86b6b5ca6d8570eaca42f149d Mon Sep 17 00:00:00 2001 From: mfedderly Date: Mon, 5 Jun 2023 20:16:50 -0400 Subject: [PATCH] Deprecate @types/flatbush - flatbush ships its own types in 4.2.0 (#65662) * use flatbush builtin types now * geoflatbush updates --- notNeededPackages.json | 4 + types/flatbush/flatbush-tests.ts | 11 --- types/flatbush/index.d.ts | 102 ------------------------- types/flatbush/tsconfig.json | 23 ------ types/flatbush/tslint.json | 1 - types/geoflatbush/geoflatbush-tests.ts | 2 +- types/geoflatbush/index.d.ts | 2 +- types/geoflatbush/package.json | 6 ++ types/geoflatbush/tsconfig.json | 3 +- 9 files changed, 14 insertions(+), 140 deletions(-) delete mode 100644 types/flatbush/flatbush-tests.ts delete mode 100644 types/flatbush/index.d.ts delete mode 100644 types/flatbush/tsconfig.json delete mode 100644 types/flatbush/tslint.json create mode 100644 types/geoflatbush/package.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 8b07ec00ff..1b8fb39d4c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1805,6 +1805,10 @@ "libraryName": "fkill", "asOfVersion": "6.0.0" }, + "flatbush": { + "libraryName": "flatbush", + "asOfVersion": "4.2.0" + }, "flatpickr": { "libraryName": "flatpickr", "asOfVersion": "3.1.2" diff --git a/types/flatbush/flatbush-tests.ts b/types/flatbush/flatbush-tests.ts deleted file mode 100644 index fc3ca65dfd..0000000000 --- a/types/flatbush/flatbush-tests.ts +++ /dev/null @@ -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); diff --git a/types/flatbush/index.d.ts b/types/flatbush/index.d.ts deleted file mode 100644 index 5f6019a0e6..0000000000 --- a/types/flatbush/index.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -// Type definitions for flatbush 3.3 -// Project: https://github.com/mourner/flatbush -// Definitions by: Matt Fedderly -// 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; diff --git a/types/flatbush/tsconfig.json b/types/flatbush/tsconfig.json deleted file mode 100644 index 1f9065c2ba..0000000000 --- a/types/flatbush/tsconfig.json +++ /dev/null @@ -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" - ] -} diff --git a/types/flatbush/tslint.json b/types/flatbush/tslint.json deleted file mode 100644 index 794cb4bf3e..0000000000 --- a/types/flatbush/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "@definitelytyped/dtslint/dt.json" } diff --git a/types/geoflatbush/geoflatbush-tests.ts b/types/geoflatbush/geoflatbush-tests.ts index 6a587d9815..68bbd5a7b5 100644 --- a/types/geoflatbush/geoflatbush-tests.ts +++ b/types/geoflatbush/geoflatbush-tests.ts @@ -1,4 +1,4 @@ -import Flatbush = require('flatbush'); +import Flatbush from 'flatbush'; import { around } from 'geoflatbush'; const index = new Flatbush(1); diff --git a/types/geoflatbush/index.d.ts b/types/geoflatbush/index.d.ts index 767a1bd0df..fe63dbf3a9 100644 --- a/types/geoflatbush/index.d.ts +++ b/types/geoflatbush/index.d.ts @@ -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. diff --git a/types/geoflatbush/package.json b/types/geoflatbush/package.json new file mode 100644 index 0000000000..866bed8403 --- /dev/null +++ b/types/geoflatbush/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "flatbush": "^4.2.0" + } +} diff --git a/types/geoflatbush/tsconfig.json b/types/geoflatbush/tsconfig.json index d6b4e88e80..d99a69ceaa 100644 --- a/types/geoflatbush/tsconfig.json +++ b/types/geoflatbush/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "ES2017" ], "noImplicitAny": true, "noImplicitThis": true,