Closed
Description
Hey @mattpocock .
Thanks for your effort and time spent on this course.
I'd suggest adding Partial
Example.
What do you think of that?
/**
* How do we make _only_ the id property mandatory?
*/
interface User {
id: string;
firstName: string;
lastName: string;
address: string;
age: number;
sex: string;
}
/**
* Answer1 - optional properties
*/
interface User {
id: string;
firstName?: string;
lastName?: string;
address?: string;
age?: number;
sex?: string;
};
/**
* Answer2 - Partial properties
*/
interface User {
id: string;
} & Partial<{
firstName: string;
lastName: string;
address: string;
age: number;
sex: string;
}>
Metadata
Metadata
Assignees
Labels
No labels