Reputation: 337
I'm using a Angular CLI : 9.1.1 so I try to update some of data not all of them,
form: UserInfo = {adresse : {}};
UserInfo.interface
export interface UserInfo {
id_user: string;
username: string;
email: string;
nom: string;
prenom: string;
telephone: number;
password: string;
specialite: string;
adresse?: Address;
}
this error has been applied :
Type '{}' is missing the following properties from type 'Address': id_adresse, adresse, code_postal, ville, and 2 more.ts(2740)
user-info.ts(12, 5): The expected type comes from property 'adresse' which is declared here on type 'UserInfo'
That's working but when I restart my app the project does'nt start. Can someone help me to solve this issue. Thanks
Upvotes: 1
Views: 676
Reputation: 6006
Make the properties optional by using ?
operator which denotes the compiler not to expect values while instantiating.
export interface UserInfo {
id_user?: string;
username?: string;
email?: string;
nom?: string;
prenom?: string;
telephone?: number;
password?: string;
specialists?: string;
adresse?: Address;
}
Upvotes: 1