Seen as how we are using Typescript for this API we should be leveraging its type casting. This means that our objects are what we expect every time. With the absence of these types the code inherits some of the same shortcomings as raw JavaScript.
In the event that a type does not exist or contain all the data required for a variable we can create our own type (combine 2 or more types), and we can also use the object spread operator to combine objects together if necessary.
Seen as how we are using Typescript for this API we should be leveraging its type casting. This means that our objects are what we expect every time. With the absence of these types the code inherits some of the same shortcomings as raw JavaScript.
In the event that a type does not exist or contain all the data required for a variable we can create our own type (combine 2 or more types), and we can also use the object spread operator to combine objects together if necessary.