Just starting out with Angular and TypeScript. I created a model with the same properties but encountered an error and am struggling to find a solution:
TS2322: Type '{ id: number; model: string; plate: string; deliveryDate: string; deadline: string; client: { fir...' is not assignable to type 'Car'. Property 'id' is missing in type '{ id: number; model: string; plate: string; deliveryDate: string; deadline: string; client: { fir...'. cars : Car = [
Here are my files:
//cars-list.component.ts
import { Car } from '../models/car';
.
.
.
cars : Car = [
{
id: 1,
model: 'Mazda Rx7',
plate: 'GD2121E',
deliveryDate: '21-04-2017',
deadline: '05-05-2016',
client: {
firstName: 'Jan',
surname: 'Kowalski'
},
cost: 300,
isFullyDamaged: true
},
...
and
//car.ts
import {Client} from './client';
export interface Car {
id: number;
model: string;
plate: string;
deliveryDate: string;
deadline: string;
client: Client;
cost: number;
isFullyDamaged: boolean;
}