diff --git a/types/set-link/index.d.ts b/types/set-link/index.d.ts new file mode 100644 index 0000000000..6978dacb9a --- /dev/null +++ b/types/set-link/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for set-link 1.0 +// Project: https://github.com/bergos/set-link +// Definitions by: 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; diff --git a/types/set-link/set-link-tests.ts b/types/set-link/set-link-tests.ts new file mode 100644 index 0000000000..867660dd88 --- /dev/null +++ b/types/set-link/set-link-tests.ts @@ -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'); +} diff --git a/types/set-link/tsconfig.json b/types/set-link/tsconfig.json new file mode 100644 index 0000000000..f7febf65b4 --- /dev/null +++ b/types/set-link/tsconfig.json @@ -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" + ] +} diff --git a/types/set-link/tslint.json b/types/set-link/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/set-link/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }