Typescript types for server errors
For API requests I wrote a little script to fetch data from a server.
It works, but for
statusCode
and statusMessage
my editor is yelling at me that the property does not exist on type 'Error'.
I get the feeling that I need a special type for server errors, because similar code is no problem on e.g. components, but I can't figure out what I need to do to make my editor happy.
It would be great if someone could point me in the right direction to figure this out.
Thanks in advance!
Here is my code:
2 Replies