title: TypeScript interface [key: string]
body: <p>I'm trying to write an interface but it keeps popin' an error:</p>
  
  <p><code>"Property 'success' of type 'boolean' is not assignable to string index type 'PageableLaravel'</code></p>
  
  <pre><code>export interface PageableLaravel {
      path: string;
      current_page: number;
      from: number;   
  }
  
  
  export interface Pageable {
      success: boolean; // &lt;-"Property 'success' of type 'boolean' is not assignable to string index type 'PageableLaravel'
      message: string; // "Property 'message' of type 'string' is not assignable to string index type 'PageableLaravel'
      [key: string]: PageableLaravel
  }
  </code></pre>
  
  <p>The <code>[key: string]</code> will always change, for example:
  Below is an example of a JSON returned from an API</p>
  
  <pre><code>{
      success: true,
      message: 'success',
      pages: {//&lt;-key name always will change
          path: "XX"
          //etc
      }
  }
  
  {
      success: true,
      message: 'success',
      products: {//&lt;-key name always will change
          path: "XX"
          //etc
      }
  }
  
  {
      success: true,
      message: 'success',
      brands: {//&lt;-key name always will change
          path: "XX"
          //etc
      }
  }
  </code></pre>
  
  <p>Is there a way to declare a key that may/may not always change? </p>