Hi I'm new in Typescript, I have an object-type variable in which might be different values from different types or nested object. now my question is that how can I define a model for this object to don't face the example error when call different keys?
For example:
export class Controller {
protected static response(res: Response, statusCode: number = 200, data: any, user: string = '', dev: string = '', code: number = 200, result: string = 'success'){
res.status(statusCode).send({
data: data,
message: {
user: '',
dev: ''
},
code: 403,
result: 'Error'
})
}
ERROR: res.status ---> This expression is not callable. Type 'Number' has no call signatures
status
under theResponse
object there is aNumber
. – Albie