mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 08:57:26 +08:00
adds typings for the 'memdown' package (#28832)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
211edbdab6
commit
6eafee412d
20
types/memdown/index.d.ts
vendored
Normal file
20
types/memdown/index.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for memdown 3.0
|
||||
// Project: https://github.com/Level/memdown
|
||||
// Definitions by: Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { AbstractLevelDOWN } from 'abstract-leveldown';
|
||||
|
||||
export interface MemDown<K, V> extends AbstractLevelDOWN<K, V> {}
|
||||
|
||||
export interface MemDownConstructor {
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(): MemDown<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(): MemDown<K, V>;
|
||||
}
|
||||
|
||||
export const MemDown: MemDownConstructor;
|
||||
export default MemDown;
|
||||
16
types/memdown/memdown-tests.ts
Normal file
16
types/memdown/memdown-tests.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import MemDown from 'memdown';
|
||||
|
||||
const test = (db: MemDown<string, string>) => {
|
||||
db.open(() => {
|
||||
db.put("key", "value", (err?: Error) => { });
|
||||
db.get("key", (err?: Error) => { });
|
||||
db.get("key", (err: Error | undefined, value: string) => { });
|
||||
db.close(() => {});
|
||||
});
|
||||
};
|
||||
|
||||
// doesn't need `new` and can be called as a function
|
||||
test(new MemDown<string, string>());
|
||||
test(new MemDown());
|
||||
test(MemDown<string, string>());
|
||||
test(MemDown());
|
||||
23
types/memdown/tsconfig.json
Normal file
23
types/memdown/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",
|
||||
"memdown-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/memdown/tslint.json
Normal file
3
types/memdown/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user