Skip to content

Commit

Permalink
Add missing nulls in the type declaration (#45)
Browse files Browse the repository at this point in the history
* Add missing nulls in the type declaration

* Remove useless tests/types.ts & add --strict for tsc
  • Loading branch information
ouuan authored Aug 29, 2021
1 parent d85e7f2 commit 0f8f0ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 65 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prebuild": "npm run lint",
"lint": "eslint src",
"build": "rollup -c && npm run types",
"types": "tsc src/index.d.ts tests/types.ts",
"types": "tsc --strict src/index.d.ts",
"prebenchmark": "npm run build",
"benchmark": "node bench/benchmark.js",
"start": "npm run test:watch",
Expand Down
20 changes: 10 additions & 10 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ export default class AVLTree<Key extends any, Value extends any> {
size: number;
insert(key: Key, data?: Value): Node<Key, Value>;
remove(key: Key): Node<Key, Value>;
find(key: Key): Node<Key, Value>;
at(index: number): Node<Key, Value>;
find(key: Key): Node<Key, Value> | null;
at(index: number): Node<Key, Value> | null;
contains(key: Key): boolean;
isEmpty(): boolean;
keys(): Array<Key>;
values(): Array<Value>;
pop(): Node<Key, Value>;
popMax(): Node<Key, Value>;
min(): Key;
max(): Key;
minNode(): Node<Key, Value>;
maxNode(): Node<Key, Value>;
pop(): Node<Key, Value> | null;
popMax(): Node<Key, Value> | null;
min(): Key | null;
max(): Key | null;
minNode(): Node<Key, Value> | null;
maxNode(): Node<Key, Value> | null;
forEach(callback: ForEachCallback<Key, Value>): AVLTree<Key, Value>;
range(minKey: Key, maxKey: Key, visit: TraverseCallback<Key, Value>, context?: any): AVLTree<Key, Value>;
load(keys: Array<Key>, values?: Array<Value>, presort?: boolean): AVLTree<Key, Value>;
prev(node: Node<Key, Value>): Node<Key, Value>;
next(node: Node<Key, Value>): Node<Key, Value>;
prev(node: Node<Key, Value>): Node<Key, Value> | null;
next(node: Node<Key, Value>): Node<Key, Value> | null;
isBalanced(): boolean;
toString(): string;
destroy(): AVLTree<Key, Value>;
Expand Down
54 changes: 0 additions & 54 deletions tests/types.ts

This file was deleted.

0 comments on commit 0f8f0ae

Please sign in to comment.