Discussion on: Get Started With TypeScript in 2019

robertcoopercode profile image
Robert Cooper Author

That's a great question, and i'm not sure what the best approach is here. My intuition tells me that
the API response doesn't require an interface, but rather the model/object you create from the API response should be typed. The reason I say this is that you don't have control over fields the API returns, but you do have control over the properties on the model/object that you create from the API response.

Hopefully that wasn't too abstract of an answer and that it made sense.

tomekbuszewski profile image
Tomek Buszewski

Hey Robert, and thanks for your answer.

While I agree with you, when I create a model, I need to know on which fields I can operate. This is a very common problem for me recently as I work with a lot of CMS' and integrate them into our app via modeling.