diff --git a/main.d.ts b/main.d.ts new file mode 100644 index 0000000..51e8d5a --- /dev/null +++ b/main.d.ts @@ -0,0 +1,29 @@ +/// + +declare namespace MegaHash +{ + type TAvailableValue = Buffer | string | object | number | BigInt | boolean | null; + + interface IStats { + indexSize: number; + metaSize: number; + dataSize: number; + numKeys: number; + numIndexes: number; + } +} + +declare class MegaHash { + set(key: string | Buffer, value: MegaHash.TAvailableValue): 0 | 1 | 2; + get(key: string | Buffer): T | undefined; + has(key: string | Buffer): boolean; + delete(key: string | Buffer): boolean; + remove(key: string | Buffer): boolean; + clear(): void; + nextKey(key?: string | Buffer): string | undefined; + length(): number; + stats(): MegaHash.IStats; +} + +export = MegaHash; +export as namespace MegaHash; diff --git a/package.json b/package.json index a2b71fe..f6e4e4e 100755 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "DJB2" ], "main": "main.js", + "typings": "./main.d.ts", "gypfile": true, "dependencies": { "bindings": "^1.0.0",