title: error TS2322: Object literal may only specify known properties, and 'labels' does not exist in type
body: <p>I have a problem that I can not explain.</p>
  
  <p>I create an angular service with the interface implementation but it tells me that I have an error that I can not explain.</p>
  
  <pre><code>error TS2322: Type '{ labels: string[]; datasets: { data: number[]; backgroundColor: string[]; hoverBackgroundColor: string[]; }[]; }' is not assignable to type 'DataBase[]'.
  </code></pre>
  
  <p>Object literal may only specify known properties, and 'labels' does not exist in type 'DataBase[]'.</p>
  
  <p>this my code :</p>
  
  <p><strong>Interface.ts</strong></p>
  
  <pre><code>export interface Dashboardtwidget {
    title: string;
    widgetType: string;
    datatype: DataBase[];
  }
  
  export interface DataBase {
   labels: string[];
   datasets: {
   data: number[];
   backgroundColor: string[];
   hoverBackgroundColor: string[]
  };
  }
  </code></pre>
  
  <p><strong>service.ts</strong></p>
  
  <pre><code>import {Injectable} from '@angular/core';
  import {Dashboardtwidget} from '../models/dashboard';
  
  
  @Injectable()
   export class DashboardService {
    data: Dashboardtwidget[] = [
    {
      title: 'Widget 1',
      widgetType: 'cardStyle1',
      datatype: {
        labels: ['A','B','C'],
        datasets: [
          {
           data: [300, 50, 100],
           backgroundColor: [
            '#FF6384',
            '#36A2EB',
            '#FFCE56'
           ],
           hoverBackgroundColor: [
            '#FF6384',
            '#36A2EB',
            '#FFCE56'
          ]
         }]
      }
    }
    }
  </code></pre>
  
  <p>Has anyone ever had this problem and this error message?</p>
  
  <p>Because I do not see where the problem comes from</p>