Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit afa2943

Browse files
fix types default export (#5852) (#5866)
Co-authored-by: shrpne <[email protected]>
1 parent e4b25bf commit afa2943

26 files changed

Lines changed: 86 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ Released with 1.0.0-beta.37 code base.
647647
- Fixed skipped ws-ganache tests (#5759)
648648
- Fixed "provider started to reconnect error" in web3-provider-ws (#5820)
649649
- Fixed Error: Number can only safely store up to 53 bits (#5845)
650+
- Fixed types for packages which have default exports but not declared default export in .d.ts (#5866)
650651

651652
### Changed
652653

packages/web3-bzz/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ export interface Pick {
3838
directory: () => Promise<any>;
3939
data: () => Promise<any>;
4040
}
41+
42+
export default Bzz

packages/web3-bzz/types/tests/bzz-test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
* @date 2018
1818
*/
1919

20-
import { Bzz } from 'web3-bzz';
20+
import BzzDefault, { Bzz } from 'web3-bzz';
21+
22+
// $ExpectType Bzz
23+
const bzz_default_empty = new BzzDefault();
2124

2225
// $ExpectType Bzz
2326
const bzz_empty = new Bzz();

packages/web3-core-method/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ export interface Method {
3232
abiCoder?: any;
3333
handleRevert?: boolean;
3434
}
35+
36+
export default Method

packages/web3-eth-accounts/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ export interface SignatureObject {
3636
s: string;
3737
v: string;
3838
}
39+
40+
export default Accounts

packages/web3-eth-accounts/types/tests/accounts-tests.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
* @author Josh Stevens <[email protected]>
1717
* @date 2018
1818
*/
19-
import { Accounts, SignedTransaction } from 'web3-eth-accounts';
19+
import AccountsDefault, { Accounts, SignedTransaction } from 'web3-eth-accounts';
20+
21+
// $ExpectType Accounts
22+
const accounts_default_empty = new AccountsDefault();
2023

2124
// $ExpectType Accounts
2225
const accounts_empty = new Accounts();

packages/web3-eth-contract/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,5 @@ export interface EventData {
177177
blockNumber: number;
178178
address: string;
179179
}
180+
181+
export default Contract

packages/web3-eth-contract/types/tests/contract-test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
* @date 2018
1919
*/
2020

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

23+
// $ExpectType Contract
24+
const contract_default = new ContractDefault([]);
25+
26+
// $ExpectType Contract
2327
const contract = new Contract([]);
2428

2529
// $ExpectType string | null

packages/web3-eth-ens/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,5 @@ export class Registry {
402402
callback?: (error: Error | TransactionRevertInstructionError, receipt: TransactionReceipt) => void
403403
): PromiEvent<TransactionReceipt | TransactionRevertInstructionError>
404404
}
405+
406+
export default Ens

packages/web3-eth-ens/types/tests/ens-test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
import { TransactionRevertInstructionError } from 'web3-core-helpers';
2121
import { TransactionReceipt } from 'web3-core';
2222
import { Contract } from 'web3-eth-contract';
23-
import { Ens, ContentHash } from 'web3-eth-ens';
23+
import EnsDefault, { Ens, ContentHash } from 'web3-eth-ens';
2424
import { Eth } from 'web3-eth';
2525

26+
// $ExpectType Ens
27+
const ens_default = new EnsDefault(new Eth('http://localhost:8545'));
28+
29+
// $ExpectType Ens
2630
const ens = new Ens(new Eth('http://localhost:8545'));
2731

2832
// $ExpectType string | null

0 commit comments

Comments
 (0)