chore: update endpoint type (#966)

This commit is contained in:
Dan Ribbens
2022-08-18 16:22:35 -04:00
committed by GitHub
parent 2cf9d35fed
commit 2b7785d101

View File

@@ -1,4 +1,4 @@
import { Express, Handler } from 'express';
import { Express, NextFunction, Response } from 'express';
import { DeepRequired } from 'ts-essentials';
import { Transporter } from 'nodemailer';
import { Options } from 'express-fileupload';
@@ -79,10 +79,16 @@ export type AccessResult = boolean | Where;
*/
export type Access = (args?: any) => AccessResult | Promise<AccessResult>;
interface PayloadHandler {(
req: PayloadRequest,
res: Response,
next: NextFunction,
): void }
export type Endpoint = {
path: string
method: 'get' | 'head' | 'post' | 'put' | 'patch' | 'delete' | 'connect' | 'options' | string
handler: Handler | Handler[]
handler: PayloadHandler | PayloadHandler[]
}
export type AdminView = React.ComponentType<{ user: User, canAccessAdmin: boolean }>