My interface contains a nested object:
export interface Person {
PersonWrapper: {
name: string;
address: string
email?: string;
}
}
When attempting to create an object from this interface, it appears that name is not mandatory, although it should be. The interface does not specify it as an optional property. Below is how I attempt to create the object:
const payload = {
PersonObj: {
address: '123 memory lane'
}
} as Person;
Why am I not receiving a compile-time error indicating that name is required? If I omit wrapping it in PersonWrapper, then I receive an error for sure.