mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type definition for "request-as-curl" (#25472)
* Add type definitions for request-as-curl * Fix TypeScript version in comment * Add correct project URL
This commit is contained in:
parent
3c6a83e0b3
commit
a84e447cb1
15
types/request-as-curl/index.d.ts
vendored
Normal file
15
types/request-as-curl/index.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Type definitions for request-as-curl 0.1
|
||||
// Project: https://github.com/azproduction/node-request-as-curl
|
||||
// Definitions by: Arne Schubert <https://github.com/atd-schubert>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { CoreOptions, Request, RequestAPI, RequiredUriUrl } from "request";
|
||||
|
||||
export = request_as_curl;
|
||||
|
||||
declare function request_as_curl(request: RequestAPI<Request, CoreOptions, RequiredUriUrl>, body?: any): string;
|
||||
|
||||
declare namespace request_as_curl {
|
||||
function serialize(request: RequestAPI<Request, CoreOptions, RequiredUriUrl>): string;
|
||||
}
|
||||
14
types/request-as-curl/request-as-curl-tests.ts
Normal file
14
types/request-as-curl/request-as-curl-tests.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import requestAsCurl = require("request-as-curl");
|
||||
|
||||
import { CoreOptions, Request, RequestAPI, RequiredUriUrl } from "request";
|
||||
|
||||
let stringValue: string;
|
||||
const req: RequestAPI<Request, CoreOptions, RequiredUriUrl> = {} as any;
|
||||
|
||||
// with optional data
|
||||
stringValue = requestAsCurl(req, {test: "data"});
|
||||
|
||||
// without optional data
|
||||
stringValue = requestAsCurl(req);
|
||||
|
||||
stringValue = requestAsCurl.serialize(req);
|
||||
23
types/request-as-curl/tsconfig.json
Normal file
23
types/request-as-curl/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"request-as-curl-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/request-as-curl/tslint.json
Normal file
1
types/request-as-curl/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user