diff --git a/abstract-leveldown/abstract-leveldown-tests.ts b/abstract-leveldown/abstract-leveldown-tests.ts new file mode 100644 index 0000000..e69de29 diff --git a/abstract-leveldown/index.d.ts b/abstract-leveldown/index.d.ts new file mode 100644 index 0000000..b7ee579 --- /dev/null +++ b/abstract-leveldown/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for abstract-leveldown +// Project: https://github.com/Level/abstract-leveldown +// Definitions by: Jaco Greeff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'abstract-leveldown' { +export interface AbstractLevelDown { +} +} diff --git a/abstract-leveldown/tsconfig.json b/abstract-leveldown/tsconfig.json new file mode 100644 index 0000000..932e246 --- /dev/null +++ b/abstract-leveldown/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "bn.js-tests.ts"] +} diff --git a/abstract-leveldown/tslint.json b/abstract-leveldown/tslint.json new file mode 100644 index 0000000..3db14f8 --- /dev/null +++ b/abstract-leveldown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/interface-connection/index.d.ts b/interface-connection/index.d.ts index be846bc..d376feb 100644 --- a/interface-connection/index.d.ts +++ b/interface-connection/index.d.ts @@ -7,9 +7,7 @@ import PeerInfo from 'peer-info'; declare module 'interface-connection' { -interface Connection { +export interface Connection { getPeerInfo (cb: (error: Error | null, peerInfo?: PeerInfo) => any): void; } - -export = Connection; } diff --git a/interface-transport/index.d.ts b/interface-transport/index.d.ts index 86062c0..432adea 100644 --- a/interface-transport/index.d.ts +++ b/interface-transport/index.d.ts @@ -4,8 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'interface-transport' { -interface Transport { +export interface Transport { } - -export = Transport; } diff --git a/leveldown/index.d.ts b/leveldown/index.d.ts new file mode 100644 index 0000000..6899d23 --- /dev/null +++ b/leveldown/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for LevelDown 3.0.0 +// Project: https://github.com/level/memdown +// Definitions by: Thiago de Arruda +// Jaco Greeff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { AbstractLevelDown } from 'abstract-leveldown'; + +declare module 'leveldown' { +const leveldown: (path: string) => AbstractLevelDown; + +export default leveldown; +} diff --git a/leveldown/leveldown-tests.ts b/leveldown/leveldown-tests.ts new file mode 100644 index 0000000..7969ad3 --- /dev/null +++ b/leveldown/leveldown-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import leveldown from 'leveldown'; + +leveldown('/tmp/test'); diff --git a/leveldown/tsconfig.json b/leveldown/tsconfig.json new file mode 100644 index 0000000..932e246 --- /dev/null +++ b/leveldown/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "bn.js-tests.ts"] +} diff --git a/leveldown/tslint.json b/leveldown/tslint.json new file mode 100644 index 0000000..3db14f8 --- /dev/null +++ b/leveldown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/libp2p-railing/index.d.ts b/libp2p-railing/index.d.ts index 9056f08..ff202b5 100644 --- a/libp2p-railing/index.d.ts +++ b/libp2p-railing/index.d.ts @@ -22,5 +22,5 @@ export class LibP2pRailing { on (event: Events, cb: (peerInfo: PeerInfo) => any): void; } -export = LibP2pRailing; +export default LibP2pRailing; } diff --git a/libp2p-tcp/index.d.ts b/libp2p-tcp/index.d.ts index ca81230..0a235c4 100644 --- a/libp2p-tcp/index.d.ts +++ b/libp2p-tcp/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @ts-ignore -import Transport from 'interface-transport'; +import { Transport } from 'interface-transport'; declare module 'libp2p-tcp' { export class LibP2pTcp implements Transport { diff --git a/libp2p-tcp/libp2p-tcp-tests.ts b/libp2p-tcp/libp2p-tcp-tests.ts index e69de29..ffc1f99 100644 --- a/libp2p-tcp/libp2p-tcp-tests.ts +++ b/libp2p-tcp/libp2p-tcp-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import TCP from 'libp2p-tcp'; + +new TCP(); diff --git a/libp2p-webrtc-direct/index.d.ts b/libp2p-webrtc-direct/index.d.ts index 9735ea2..175bbdd 100644 --- a/libp2p-webrtc-direct/index.d.ts +++ b/libp2p-webrtc-direct/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @ts-ignore -import Transport from 'interface-transport'; +import { Transport } from 'interface-transport'; declare module 'libp2p-webrtc-direct' { export class LibP2pWebRtcDirect implements Transport { diff --git a/libp2p-webrtc-direct/libp2p-webrtc-direct-tests.ts b/libp2p-webrtc-direct/libp2p-webrtc-direct-tests.ts index e69de29..3a598e4 100644 --- a/libp2p-webrtc-direct/libp2p-webrtc-direct-tests.ts +++ b/libp2p-webrtc-direct/libp2p-webrtc-direct-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import T from 'libp2p-webrtc-direct'; + +new T(); diff --git a/libp2p-webrtc-star/index.d.ts b/libp2p-webrtc-star/index.d.ts index 9d795f9..521216b 100644 --- a/libp2p-webrtc-star/index.d.ts +++ b/libp2p-webrtc-star/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @ts-ignore -import Transport from 'interface-transport'; +import { Transport } from 'interface-transport'; declare module 'libp2p-webrtc-star' { export class LibP2pWebRtcStar implements Transport { diff --git a/libp2p-webrtc-star/libp2p-webrtc-star-tests.ts b/libp2p-webrtc-star/libp2p-webrtc-star-tests.ts index e69de29..92070ba 100644 --- a/libp2p-webrtc-star/libp2p-webrtc-star-tests.ts +++ b/libp2p-webrtc-star/libp2p-webrtc-star-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import T from 'libp2p-webrtc-star'; + +new T(); diff --git a/libp2p-websockets/index.d.ts b/libp2p-websockets/index.d.ts index 719fa80..8b89346 100644 --- a/libp2p-websockets/index.d.ts +++ b/libp2p-websockets/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @ts-ignore -import Transport from 'interface-transport'; +import { Transport } from 'interface-transport'; declare module 'libp2p-websockets' { export class LibP2pWebsockets implements Transport { diff --git a/libp2p-websockets/libp2p-websockets-tests.ts b/libp2p-websockets/libp2p-websockets-tests.ts index e69de29..9bac725 100644 --- a/libp2p-websockets/libp2p-websockets-tests.ts +++ b/libp2p-websockets/libp2p-websockets-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import T from 'libp2p-websockets'; + +new T(); diff --git a/libp2p/index.d.ts b/libp2p/index.d.ts index be7778e..a6af667 100644 --- a/libp2p/index.d.ts +++ b/libp2p/index.d.ts @@ -4,9 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @ts-ignore -import Connection from 'interface-connection'; +import { Connection } from 'interface-connection'; // @ts-ignore -import Transport from 'interface-transport'; +import { Transport } from 'interface-transport'; // @ts-ignore import { Libp2pKadDHT } from 'libp2p-kad-dht'; // @ts-ignore @@ -49,5 +49,7 @@ export class LibP2p { stop (cb: (error: Error | null) => any): void; } -export default LibP2p; +const libp2p: LibP2p; + +export default libp2p; } diff --git a/memdown/LICENSE b/memdown/LICENSE deleted file mode 100644 index 4b1ad51..0000000 --- a/memdown/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/memdown/README.md b/memdown/README.md deleted file mode 100644 index d2499a4..0000000 --- a/memdown/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/leveldown` - -# Summary -This package contains type definitions for LevelDown (https://github.com/level/leveldown). - -# Details -Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leveldown - -Additional Details - * Last updated: Fri, 05 May 2017 04:05:52 GMT - * Dependencies: node - * Global values: none - -# Credits -These definitions were written by Thiago de Arruda . diff --git a/memdown/index.d.ts b/memdown/index.d.ts index f44e5e9..f574424 100644 --- a/memdown/index.d.ts +++ b/memdown/index.d.ts @@ -4,145 +4,10 @@ // Jaco Greeff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import { AbstractLevelDown } from 'abstract-leveldown'; declare module 'memdown' { -namespace memdown { - type Bytes = string | Buffer; - type ErrCallback = (error: any) => void; - type ErrNumberCallback = (error: any, value: number) => void; - type ErrBufferCallback = (error: any, value: Buffer) => void; - type ErrStringCallback = (error: any, value: string) => void; - type KeyAsStringCallback = (error: any, key: string, value: Buffer) => void; - type ValueAsStringCallback = (error: any, key: Buffer, value: string) => void; - type KeyAndValueAsStringCallback = (error: any, key: string, value: string) => void; - type KeyAndValueAsBufferCallback = (error: any, key: Buffer, value: Buffer) => void; +const memdown: () => AbstractLevelDown; - interface PutBatch { - type: "put"; - key: Bytes; - value: Bytes; - } - - interface DelBatch { - type: "del"; - key: Bytes; - } - - type Batch = PutBatch | DelBatch; - - interface OpenOptions { - createIfMissing?: boolean; - errorIfExists?: boolean; - compression?: boolean; - cacheSize?: number; - } - - interface OpenAdvancedOptions extends OpenOptions { - writeBufferSize?: number; - blockSize?: number; - maxOpenFiles?: number; - blockRestartInterval?: number; - maxFileSize?: number; - } - - interface WriteOptions { - sync?: boolean; - } - - interface ReadOptions { - fillCache?: boolean; - } - - interface BufferReadOptions extends ReadOptions { - asBuffer?: true; - } - - interface StringReadOptions extends ReadOptions { - asBuffer: false; - } - - interface IteratorOptions { - gt?: Bytes; - lt?: Bytes; - gte?: Bytes; - lte?: Bytes; - reverse?: boolean; - keys?: boolean; - values?: boolean; - limit?: number; - fillCache?: boolean; - } - - interface KeyAsStringIteratorOptions extends IteratorOptions { - keyAsBuffer: false; - valueAsBuffer?: true; - } - - interface ValueAsStringIteratorOptions extends IteratorOptions { - keyAsBuffer?: true; - valueAsBuffer: false; - } - - interface KeyAndValueAsStringIteratorOptions extends IteratorOptions { - keyAsBuffer: false; - valueAsBuffer: false; - } - - interface KeyAndValueAsBufferIteratorOptions extends IteratorOptions { - keyAsBuffer?: true; - valueAsBuffer?: true; - } - - interface Iterator { - seek(key: Bytes): void; - end(callback: ErrCallback): void; - } - - interface KeyAsStringIterator extends Iterator { - next(callback: KeyAsStringCallback): void; - } - - interface ValueAsStringIterator extends Iterator { - next(callback: ValueAsStringCallback): void; - } - - interface KeyAndValueAsStringIterator extends Iterator { - next(callback: KeyAndValueAsStringCallback): void; - } - - interface KeyAndValueAsBufferIterator extends Iterator { - next(callback: KeyAndValueAsBufferCallback): void; - } - - interface MemDown { - open(callback: ErrCallback): void; - open(options: OpenOptions, callback: ErrCallback): void; - close(callback?: ErrCallback): void; - put(key: Bytes, value: Bytes, callback: ErrCallback): void; - put(key: Bytes, value: Bytes, options: WriteOptions, callback: ErrCallback): void; - get(key: Bytes, callback: ErrBufferCallback): void; - get(key: Bytes, options: BufferReadOptions, callback: ErrBufferCallback): void; - get(key: Bytes, options: StringReadOptions, callback: ErrStringCallback): void; - del(key: Bytes, callback?: ErrCallback): void; - del(key: Bytes, options: WriteOptions, callback?: ErrCallback): void; - batch(operations: Batch[], callback?: ErrCallback): void; - batch(operations: Batch[], options?: WriteOptions, callback?: ErrCallback): void; - approximateSize(start: Bytes, end: Bytes, callback: ErrNumberCallback): void; - compactRange(start: Bytes, end: Bytes, callback: ErrCallback): void; - getProperty(property: string): string; - iterator(options?: KeyAsStringIteratorOptions): KeyAsStringIterator; - iterator(options?: ValueAsStringIteratorOptions): ValueAsStringIterator; - iterator(options?: KeyAndValueAsStringIteratorOptions): KeyAndValueAsStringIterator; - iterator(options?: KeyAndValueAsBufferIteratorOptions): KeyAndValueAsBufferIterator; - destroy(location: string, callback: ErrCallback): void; - repair(location: string, callback: ErrCallback): void; - } - - type Constructor = () => MemDown; -} - -const memdownConstrctor: memdown.Constructor; - -export = memdownConstrctor; +export default memdown; } diff --git a/memdown/memdown-tests.ts b/memdown/memdown-tests.ts new file mode 100644 index 0000000..f4db882 --- /dev/null +++ b/memdown/memdown-tests.ts @@ -0,0 +1,4 @@ +// @ts-ignore +import memdown from 'memdown'; + +memdown(); diff --git a/memdown/package.json b/memdown/package.json deleted file mode 100644 index 9a0f748..0000000 --- a/memdown/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@types/leveldown", - "version": "1.7.0", - "description": "TypeScript definitions for LevelDown", - "license": "MIT", - "contributors": [ - { - "name": "Thiago de Arruda", - "url": "https://github.com/tarruda" - } - ], - "main": "", - "repository": { - "type": "git", - "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "dependencies": { - "@types/node": "*" - }, - "peerDependencies": {}, - "typesPublisherContentHash": "8ad2a943006b3c5296b92869b9a520d84e733c731edabe2e500821f18f35b56f", - "typeScriptVersion": "2.0" -} \ No newline at end of file diff --git a/memdown/tsconfig.json b/memdown/tsconfig.json new file mode 100644 index 0000000..932e246 --- /dev/null +++ b/memdown/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "bn.js-tests.ts"] +} diff --git a/memdown/tslint.json b/memdown/tslint.json new file mode 100644 index 0000000..3db14f8 --- /dev/null +++ b/memdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }