mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
upadating README: notes on CommonJS autocomplete (#2256)
closes #2226. add note on how to gain typings / autocomplete / intellisense when using CommonJS (`require()`) imports
This commit is contained in:
@@ -57,6 +57,15 @@ Using cdn:
|
|||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
### note: CommonJS usage
|
||||||
|
In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const axios = require('axios').default;
|
||||||
|
|
||||||
|
// axios.<method> will now provide autocomplete and parameter typings
|
||||||
|
```
|
||||||
|
|
||||||
Performing a `GET` request
|
Performing a `GET` request
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user