feat: types for set-link which augments express (#40374)

This commit is contained in:
Tomasz Pluskiewicz
2019-11-14 12:48:53 -08:00
committed by Pranav Senthilnathan
parent a17cab9a29
commit 32b0df8a68
4 changed files with 51 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for set-link 1.0
// Project: https://github.com/bergos/set-link
// Definitions by: tpluscode <https://github.com/tpluscode>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { RequestHandler } from "express";
declare module 'express' {
interface Response {
setLink(link: string, rel: string): void;
}
}
declare const middleware: RequestHandler;
export = middleware;
+10
View File
@@ -0,0 +1,10 @@
import express = require('express');
import setLink = require('set-link');
const app = express();
app.use(setLink);
function handler(req: express.Request, res: express.Response) {
res.setLink('http://example.com/', 'self');
}
+23
View 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",
"set-link-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }