Adjust exports

This commit is contained in:
Jaco Greeff 2018-06-22 16:38:26 +02:00
parent ee44183d45
commit c2a46c25f7
27 changed files with 112 additions and 213 deletions

9
abstract-leveldown/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for abstract-leveldown
// Project: https://github.com/Level/abstract-leveldown
// Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'abstract-leveldown' {
export interface AbstractLevelDown {
}
}

View File

@ -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"]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -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;
}

View File

@ -4,8 +4,6 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'interface-transport' {
interface Transport {
export interface Transport {
}
export = Transport;
}

13
leveldown/index.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// Type definitions for LevelDown 3.0.0
// Project: https://github.com/level/memdown
// Definitions by: Thiago de Arruda <https://github.com/tarruda>
// Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { AbstractLevelDown } from 'abstract-leveldown';
declare module 'leveldown' {
const leveldown: (path: string) => AbstractLevelDown;
export default leveldown;
}

View File

@ -0,0 +1,4 @@
// @ts-ignore
import leveldown from 'leveldown';
leveldown('/tmp/test');

16
leveldown/tsconfig.json Normal file
View File

@ -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"]
}

1
leveldown/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -22,5 +22,5 @@ export class LibP2pRailing {
on (event: Events, cb: (peerInfo: PeerInfo) => any): void;
}
export = LibP2pRailing;
export default LibP2pRailing;
}

View File

@ -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 {

View File

@ -0,0 +1,4 @@
// @ts-ignore
import TCP from 'libp2p-tcp';
new TCP();

View File

@ -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 {

View File

@ -0,0 +1,4 @@
// @ts-ignore
import T from 'libp2p-webrtc-direct';
new T();

View File

@ -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 {

View File

@ -0,0 +1,4 @@
// @ts-ignore
import T from 'libp2p-webrtc-star';
new T();

View File

@ -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 {

View File

@ -0,0 +1,4 @@
// @ts-ignore
import T from 'libp2p-websockets';
new T();

8
libp2p/index.d.ts vendored
View File

@ -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;
}

View File

@ -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

View File

@ -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 <https://github.com/tarruda>.

141
memdown/index.d.ts vendored
View File

@ -4,145 +4,10 @@
// Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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;
}

4
memdown/memdown-tests.ts Normal file
View File

@ -0,0 +1,4 @@
// @ts-ignore
import memdown from 'memdown';
memdown();

View File

@ -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"
}

16
memdown/tsconfig.json Normal file
View File

@ -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"]
}

1
memdown/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }