I'm trying to move to typescript with my Node/Express app. Previously my code was:
//app.js
const error = new Error('Not Found');
error.status = 404;
When I try this:
//app.ts
const error = new Error('Not Found');
error.status = 404; // Property 'status' does not exist on type 'Error'.ts(2339)
I understand from developer.mozilla.org documentation that the Error constructor has the following optional parameters: message, options, fileName, lineNumber - so I guess status shouldn't be permitted? I think I've copied it from a youtube tutorial so I guess it's not actually good practice?