mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
declare Express in ambient environment
This commit is contained in:
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
// Type definitions for http-errors-tests.ts
|
||||
declare namespace Express {
|
||||
export interface Request {
|
||||
user?: any
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,19 @@
|
||||
/// <reference path="http-errors.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../http-errors/http-errors-tests.x.ts" />
|
||||
|
||||
import * as createError from 'http-errors';
|
||||
import * as express from 'express';
|
||||
|
||||
var app = express();
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
export interface Request {
|
||||
user?: any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.user) return next(createError(401, 'Please login to view this page.'));
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user