I have express typing installed with typescript 1.8.10, and this code:
app.use( function( err, req, res, next ) {
if ( err.code !== 'EBADCSRFTOKEN' ) {
return next( err )
}
res.status( 403 )
res.send( 'form tampered with' )
} )
which is the csrf error detection middleware code, causes the following errors:
Error: (130, 10) TS2345: argument of type '(err: Request, req: Response, res: NextFunction, next: any) => any' no parameter of type 'string | RegExp | (line | RegExp) [] '. Type '(err: Request, req: Response, res: NextFunction, next: any) => any' is not assigned to type '(string | RegExp) []'. The property '[Symbol.iterator]' is missing in the type '(err: Request, req: Response, res: NextFunction, next: any) => any'.
: (131, 14) TS2339: 'code' 'Request'.
: (136, 9) TS2339: 'status' 'NextFunction'.
: (137, 9) TS2339: 'send' 'NextFunction'.
?