Friday 2 June 2017

Property 'body' does not exist on type 'Request'

The req variable of Request type has no intellisense for property body. Is this due to the typings?

import { Request, Response } from 'express'
import { ok, bad } from './responses'

export const signIn: async (req: Request, res: Response) => {
    try {
        const { name, pword } = req.body // body is not recognized
        const data = auth.signIn(name, password)
        ok(res, data)
    } catch (error) {
        bad(res, error)
    }
}



via Mel Adane

No comments:

Post a Comment