mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add type definitions for bidirectional-map (#25459)
This commit is contained in:
parent
d6da19d371
commit
d79f176a3a
19
types/bidirectional-map/bidirectional-map-tests.ts
Normal file
19
types/bidirectional-map/bidirectional-map-tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import BiMap from "bidirectional-map";
|
||||
|
||||
const bidirectionalMap = new BiMap({
|
||||
one: 1
|
||||
});
|
||||
bidirectionalMap.size; // $ExpectType number
|
||||
bidirectionalMap.set("two", 2);
|
||||
bidirectionalMap.set("three", 3);
|
||||
bidirectionalMap.get("one"); // $ExpectType number
|
||||
bidirectionalMap.get(true); // $ExpectError
|
||||
bidirectionalMap.getKey(1); // $ExpectType string
|
||||
bidirectionalMap.getKey("one"); // $ExpectError
|
||||
bidirectionalMap.delete("two");
|
||||
bidirectionalMap.deleteValue(3);
|
||||
bidirectionalMap.entries(); // $ExpectType IterableIterator<[string, number]>
|
||||
bidirectionalMap.has("one"); // $ExpectType boolean
|
||||
bidirectionalMap.hasValue(2); // $ExpectType boolean
|
||||
bidirectionalMap.keys(); // $ExpectType IterableIterator<string>
|
||||
bidirectionalMap.values(); // $ExpectType IterableIterator<number>
|
||||
22
types/bidirectional-map/index.d.ts
vendored
Normal file
22
types/bidirectional-map/index.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Type definitions for bidirectional-map 1.0
|
||||
// Project: https://github.com/educastellano/bidirectional-map
|
||||
// Definitions by: Helen Anderson <https://github.com/helenanderson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export default class BiMap<TValue> {
|
||||
constructor(object?: { [i: string]: TValue });
|
||||
size: number;
|
||||
|
||||
set(key: string, value: TValue): void;
|
||||
get(key: string): TValue;
|
||||
getKey(value: TValue): string;
|
||||
clear(): void;
|
||||
delete(key: string): void;
|
||||
deleteValue(value: TValue): void;
|
||||
entries(): IterableIterator<[string, TValue]>;
|
||||
has(key: string): boolean;
|
||||
hasValue(value: TValue): boolean;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<TValue>;
|
||||
}
|
||||
23
types/bidirectional-map/tsconfig.json
Normal file
23
types/bidirectional-map/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bidirectional-map-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/bidirectional-map/tslint.json
Normal file
1
types/bidirectional-map/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user