You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,25 @@ web3.eth.getAccounts()
81
81
.then(console.log);
82
82
```
83
83
84
+
### Usage with TypeScript
85
+
86
+
Type definitions are maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) by others. You can install them with
87
+
88
+
```bash
89
+
npm install --dev @types/web3.js
90
+
```
91
+
92
+
You might need to install type definitions for `bignumber.js` and `lodash` too.
93
+
94
+
And then use `web3.js` as follows:
95
+
96
+
```typescript
97
+
importWeb3=require("web3"); // Note the special syntax! Copy this line when in doubt!
98
+
const web3 =newWeb3("ws://localhost:8546");
99
+
```
100
+
101
+
**Please note:** We do not support TypeScript ourselves. If you have any issue with TypeScript and `web3.js` do not create an issue here. Go over to DefinitelyTyped and do it there.
102
+
84
103
## Documentation
85
104
86
105
Documentation can be found at [read the docs][docs]
0 commit comments