mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add superagent-proxy types (#41691)
This commit is contained in:
parent
6d5145eb99
commit
d62fccf391
17
types/superagent-proxy/index.d.ts
vendored
Normal file
17
types/superagent-proxy/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for superagent-proxy 2.0
|
||||
// Project: https://github.com/TooTallNate/superagent-proxy#readme
|
||||
// Definitions by: Daniel Imhoff <https://github.com/dwieeb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
import * as superagent from 'superagent';
|
||||
|
||||
declare module 'superagent' {
|
||||
interface Request {
|
||||
proxy(url: string): this;
|
||||
}
|
||||
}
|
||||
|
||||
declare function superagentProxy(s: typeof superagent): void;
|
||||
|
||||
export = superagentProxy;
|
||||
14
types/superagent-proxy/superagent-proxy-tests.ts
Normal file
14
types/superagent-proxy/superagent-proxy-tests.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import request = require('superagent');
|
||||
import proxy = require('superagent-proxy');
|
||||
|
||||
// Patch superagent with `.proxy()` method
|
||||
proxy(request);
|
||||
|
||||
const callback = (err: any, res: request.Response) => {};
|
||||
const proxyUrl = 'http://localhost:8888';
|
||||
|
||||
// using proxy
|
||||
request
|
||||
.get('/search')
|
||||
.proxy(proxyUrl)
|
||||
.end(callback);
|
||||
23
types/superagent-proxy/tsconfig.json
Normal file
23
types/superagent-proxy/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"superagent-proxy-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/superagent-proxy/tslint.json
Normal file
1
types/superagent-proxy/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user