title: typescript how to declare nested data type from interface
body: <p>I have the following typescript interface:</p>
  
  <pre><code>interface IFoodShop {
      name: string;
      owner: string;
      foods: Array&lt;{
          id: number,
          name: string,
          isVegetarian: boolean
      }&gt;
  }
  </code></pre>
  
  <p>I have a function that requires the paramater to be the same data type as the foods array from interface IFoodShop. How would i declare it, similar to something this, which doesn't work.</p>
  
  <pre><code>// check if food is vegetarian
  isVegatarianFood(data: IFoodShop.foods) {
  
  
  }
  </code></pre>
  
  <p>I understand I can break down the data types like below:</p>
  
  <pre><code>interface IFoodShopFood {
      id: number,
      name: string,
      isVegetarian: boolean
  }
  
  interface IFoodShop {
      name: string;
      owner: string;
      openDate: Date;
      foods: IFoodShopFood
  }
  
  // check if food is vegetarian
  isVegatarianFood(data: IFoodShopFood) {
  
  
  }
  </code></pre>
  
  <p>But this to me seems unecessary when I have a lot of arrays to declare. How would I simply say that the data type needs to match the nested interface data type foods?</p>