Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix types default export #5852

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,4 @@ Released with 1.0.0-beta.37 code base.

- Fixed skipped ws-ganache tests (#5759)
- Fixed "provider started to reconnect error" in web3-provider-ws (#5820)
- Fixed types for packages which have default exports but not declared default export in .d.ts
2 changes: 2 additions & 0 deletions packages/web3-bzz/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ export interface Pick {
directory: () => Promise<any>;
data: () => Promise<any>;
}

export default Bzz
5 changes: 4 additions & 1 deletion packages/web3-bzz/types/tests/bzz-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
* @date 2018
*/

import { Bzz } from 'web3-bzz';
import BzzDefault, { Bzz } from 'web3-bzz';

// $ExpectType Bzz
const bzz_default_empty = new BzzDefault();

// $ExpectType Bzz
const bzz_empty = new Bzz();
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-core-method/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ export interface Method {
abiCoder?: any;
handleRevert?: boolean;
}

export default Method
2 changes: 2 additions & 0 deletions packages/web3-eth-accounts/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ export interface SignatureObject {
s: string;
v: string;
}

export default Accounts
5 changes: 4 additions & 1 deletion packages/web3-eth-accounts/types/tests/accounts-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
* @author Josh Stevens <joshstevens19@hotmail.co.uk>
* @date 2018
*/
import { Accounts, SignedTransaction } from 'web3-eth-accounts';
import AccountsDefault, { Accounts, SignedTransaction } from 'web3-eth-accounts';

// $ExpectType Accounts
const accounts_default_empty = new AccountsDefault();

// $ExpectType Accounts
const accounts_empty = new Accounts();
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth-contract/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,5 @@ export interface EventData {
blockNumber: number;
address: string;
}

export default Contract
6 changes: 5 additions & 1 deletion packages/web3-eth-contract/types/tests/contract-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
* @date 2018
*/

import { Contract } from 'web3-eth-contract';
import ContractDefault, { Contract } from 'web3-eth-contract';

// $ExpectType Contract
const contract_default = new ContractDefault([]);

// $ExpectType Contract
const contract = new Contract([]);

// $ExpectType string | null
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth-ens/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,5 @@ export class Registry {
callback?: (error: Error | TransactionRevertInstructionError, receipt: TransactionReceipt) => void
): PromiEvent<TransactionReceipt | TransactionRevertInstructionError>
}

export default Ens
6 changes: 5 additions & 1 deletion packages/web3-eth-ens/types/tests/ens-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
import { TransactionRevertInstructionError } from 'web3-core-helpers';
import { TransactionReceipt } from 'web3-core';
import { Contract } from 'web3-eth-contract';
import { Ens, ContentHash } from 'web3-eth-ens';
import EnsDefault, { Ens, ContentHash } from 'web3-eth-ens';
import { Eth } from 'web3-eth';

// $ExpectType Ens
const ens_default = new EnsDefault(new Eth('http://localhost:8545'));

// $ExpectType Ens
const ens = new Ens(new Eth('http://localhost:8545'));

// $ExpectType string | null
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth-iban/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ export interface IndirectOptions {
institution: string;
identifier: string;
}

export default Iban
5 changes: 4 additions & 1 deletion packages/web3-eth-iban/types/tests/iban-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
* @date 2018
*/

import { Iban, IndirectOptions } from 'web3-eth-iban';
import IbanDefault, { Iban, IndirectOptions } from 'web3-eth-iban';

const iban = 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS';
const address = '0x45cd08334aeedd8a06265b2ae302e3597d8faa28';

// $ExpectType Iban
const iban_default = new IbanDefault(iban);

// $ExpectType Iban
const ibanClass = new Iban(iban);

Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth-personal/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ export class Personal {
callback?: (error: Error, result: string) => void
): Promise<string>;
}

export default Personal
5 changes: 4 additions & 1 deletion packages/web3-eth-personal/types/tests/personal-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
*/

import { RLPEncodedTransaction } from 'web3-core';
import { Personal } from 'web3-eth-personal';
import PersonalDefault, { Personal } from 'web3-eth-personal';

// $ExpectType Personal
const personal_default_empty = new PersonalDefault();

// $ExpectType Personal
const personal_empty = new Personal();
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-eth/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,5 @@ export interface FeeHistoryResult {
oldestBlock: number;
reward: string[][];
}

export default Eth
5 changes: 4 additions & 1 deletion packages/web3-eth/types/tests/eth.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

import {Log} from 'web3-core';
import {
import EthDefault, {
BlockTransactionObject,
BlockTransactionString,
BlockHeader,
Expand All @@ -38,6 +38,9 @@ import {
import BN = require('bn.js');
import BigNumber from 'bignumber.js';

// $ExpectType Eth
const eth_default_empty = new EthDefault();

// $ExpectType Eth
const eth_empty = new Eth();

Expand Down
2 changes: 2 additions & 0 deletions packages/web3-net/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
import { NetworkBase } from 'web3-core';

export class Network extends NetworkBase {}

export default Network
5 changes: 4 additions & 1 deletion packages/web3-net/types/tests/network-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
* @date 2018
*/

import { Network } from 'web3-net';
import NetworkDefault, { Network } from 'web3-net';

// $ExpectType Network
const network_default_empty = new NetworkDefault();

// $ExpectType Network
const network_empty = new Network();
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-providers-http/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ export class HttpProvider extends HttpProviderBase {
disconnect(): boolean;
supportsSubscriptions(): boolean;
}

export default HttpProvider
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@

import * as http from 'http';
import * as https from 'https';
import { HttpProvider } from 'web3-providers';
import HttpProviderDefault, { HttpProvider } from 'web3-providers';
import { JsonRpcResponse } from 'web3-core-helpers';

// $ExpectType HttpProvider
const http_provider_default_empty = new HttpProviderDefault();

// $ExpectType HttpProvider
const http_provider_empty = new HttpProvider();

// $ExpectType HttpProvider
const httpProvider = new HttpProvider('http://localhost:8545', {
timeout: 20000,
headers: [
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-providers-ipc/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
import { IpcProviderBase } from 'web3-core-helpers';

export class IpcProvider extends IpcProviderBase { }

export default IpcProvider
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@
*/

import * as net from 'net';
import { IpcProvider } from 'web3-providers';
import IpcProviderDefault, { IpcProvider } from 'web3-providers';
import { JsonRpcResponse } from 'web3-core-helpers';

// $ExpectType IpcProvider
const ipc_provider_default = new IpcProviderDefault(
'/Users/myuser/Library/Ethereum/geth.ipc',
new net.Server()
);

// $ExpectType IpcProvider
const ipcProvider = new IpcProvider(
'/Users/myuser/Library/Ethereum/geth.ipc',
new net.Server()
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-providers-ws/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
import { WebsocketProviderBase } from 'web3-core-helpers';

export class WebsocketProvider extends WebsocketProviderBase { }

export default WebsocketProvider
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import { WebsocketProviderOptions, JsonRpcResponse } from 'web3-core-helpers';
import { WebsocketProvider } from 'web3-providers';
import WebsocketProviderDefault, { WebsocketProvider } from 'web3-providers';

const options: WebsocketProviderOptions = {
timeout: 30000,
Expand All @@ -30,6 +30,10 @@ const options: WebsocketProviderOptions = {
}
};

// $ExpectType WebsocketProvider
const ws_provider_default = new WebsocketProviderDefault('ws://localhost:8545', options);

// $ExpectType WebsocketProvider
const wsProvider = new WebsocketProvider('ws://localhost:8545', options);

// $ExpectType boolean
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-shh/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,5 @@ export interface Subscribe {

on(type: 'error', handler: (data: Error) => void): void;
}

export default Shh
5 changes: 4 additions & 1 deletion packages/web3-shh/types/tests/shh-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
* @date 2018
*/

import { Info, Notification, Shh } from 'web3-shh';
import ShhDefault, { Info, Notification, Shh } from 'web3-shh';

// $ExpectType Shh
const shh_default_empty = new ShhDefault();

// $ExpectType Shh
const shh_empty = new Shh();
Expand Down