mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
feat: types for set-link which augments express (#40374)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
a17cab9a29
commit
32b0df8a68
Vendored
+17
@@ -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;
|
||||
@@ -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');
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user