mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
typings for absolute-url (#47031)
This commit is contained in:
parent
1ffd978095
commit
d9e47130b5
12
types/absolute-url/absolute-url-tests.ts
Normal file
12
types/absolute-url/absolute-url-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import express = require('express');
|
||||
import absoluteUrl = require('absolute-url');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(absoluteUrl());
|
||||
|
||||
app.get('/', (req) => {
|
||||
absoluteUrl.attach(req);
|
||||
|
||||
const url: string = req.absoluteUrl();
|
||||
});
|
||||
21
types/absolute-url/index.d.ts
vendored
Normal file
21
types/absolute-url/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for absolute-url 1.2
|
||||
// Project: https://github.com/zazukoians/absolute-url
|
||||
// Definitions by: tpluscode <https://github.com/tpluscode>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { RequestHandler, Request } from "express";
|
||||
|
||||
declare module 'express-serve-static-core' {
|
||||
interface Request {
|
||||
absoluteUrl(): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface AbsoluteUrl {
|
||||
(): RequestHandler;
|
||||
attach(req: Request): void;
|
||||
}
|
||||
|
||||
declare const middleware: AbsoluteUrl;
|
||||
|
||||
export = middleware;
|
||||
23
types/absolute-url/tsconfig.json
Normal file
23
types/absolute-url/tsconfig.json
Normal 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",
|
||||
"absolute-url-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/absolute-url/tslint.json
Normal file
1
types/absolute-url/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user