create @types/lifeomic__axios-fetch (#39227)

This commit is contained in:
Jason Di Benedetto
2019-10-22 14:26:45 -07:00
committed by Wesley Wigham
parent 1db2d563c0
commit cdd7ff1a42
5 changed files with 66 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for @lifeomic/axios-fetch 1.4
// Project: https://github.com/lifeomic/axios-fetch
// Definitions by: Jason Di Benedetto <https://github.com/jasondibenedetto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Response, RequestInfo, RequestInit } from 'node-fetch';
import { AxiosInstance, AxiosTransformer } from 'axios';
export function buildAxiosFetch(
axios: AxiosInstance,
transformer?: AxiosTransformer,
): (url: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -0,0 +1,18 @@
import axios from 'axios';
import { buildAxiosFetch } from '@lifeomic/axios-fetch';
const instance = axios.create();
const fetch = buildAxiosFetch(instance, config => {
config.timeout = 1000;
return config;
});
fetch('https://jsonplaceholder.typicode.com/users', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}).then(response => {
return response.json();
});
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"axios": "^0.19.0"
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@lifeomic/axios-fetch": [
"lifeomic__axios-fetch"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"lifeomic__axios-fetch-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }