Typescript interface problem

I taken the course of ultimate typescript, but when I particularly want to try to fetch data form an api structure like the Image. I found that I Dont know what should do.

I should define all the interface like

interface IResponseData {
interface IData{

or I should just use type any?

I think interfaces do not have to be comprehensive as long as the data returned has at least the stuff you are exposing on your interface. So if all you care about is the status, the coin’s symbol and the coin’s price then you only need to include the minimal amount of code to get you there:

interface ResponseData {
  status: string;
  data: Data;

interface Data {
  coins: Coin[];

interface Coin {
  symbol: string;
  value: number;

Then when you fetch it you can just use the data you need:

if (responseData.status !== "success") {
  // handle the error
for (let coin of responseData.data.coins) {
  // do something with coin.symbol and coin.price
1 Like

Thank you so much jmrunkle,finally solved the problem that border me whole night.