swaf/src/types/Express.d.ts

35 lines
723 B
TypeScript
Raw Normal View History

2020-06-14 21:47:18 +02:00
import {Files} from "formidable";
import {Type} from "../Utils";
import Middleware from "../Middleware";
import {FlashMessages} from "../components/SessionComponent";
import {Logger} from "tslog";
2020-04-22 15:52:17 +02:00
declare global {
namespace Express {
export interface Request {
log: Logger;
getSession(): Session;
2020-06-14 21:47:18 +02:00
files: Files;
2020-04-22 15:52:17 +02:00
middlewares: Middleware[];
as<M extends Middleware>(type: Type<M>): M;
flash(): FlashMessages;
2020-04-22 15:52:17 +02:00
flash(message: string): unknown[];
2020-04-22 15:52:17 +02:00
flash(event: string, message: string): void;
}
2020-04-22 15:52:17 +02:00
export interface Response {
redirectBack(defaultUrl?: string): void;
}
2020-04-22 15:52:17 +02:00
}
}