mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Type definition for mock-express-request (#42985)
This commit is contained in:
parent
282a27a0c2
commit
584eb9feba
10
types/mock-express-request/index.d.ts
vendored
Normal file
10
types/mock-express-request/index.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
// Type definitions for mock-express-request 0.2
|
||||
// Project: https://github.com/lykmapipo/mock-express-request
|
||||
// Definitions by: Fela Maslen <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Request } from 'express';
|
||||
|
||||
declare function MockExpressRequest(options?: object): Request;
|
||||
|
||||
export = MockExpressRequest;
|
||||
18
types/mock-express-request/mock-express-request-tests.ts
Normal file
18
types/mock-express-request/mock-express-request-tests.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Request } from 'express';
|
||||
import MockExpressRequest from 'mock-express-request';
|
||||
|
||||
function doSomethingWithRequest(req: Request): void {
|
||||
console.log(req.headers);
|
||||
}
|
||||
|
||||
function testMockExpressRequest() {
|
||||
doSomethingWithRequest(MockExpressRequest());
|
||||
|
||||
doSomethingWithRequest(
|
||||
MockExpressRequest({
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
24
types/mock-express-request/tsconfig.json
Normal file
24
types/mock-express-request/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mock-express-request-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/mock-express-request/tslint.json
Normal file
1
types/mock-express-request/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user