I'm exploring how to utilize the Required keyword to ensure that all members are not optional in TypeScript. I've achieved success with it so far, but I've run into an issue where it doesn't seem to work for nested members of an interface. Is there a method to inform TypeScript that all members should not be undefined?
interface Camera {
id? :string;
name? : {
firstName?:string;
secondName? :string
};
site? :string
}
const firstCamera :Required<Camera> ={
id :'1',
name :{},
site :'hello world'
}
While the code above functions properly for the initial members, firstName and secondName remain optional. I am seeking a solution to make them required fields as well. Any guidance would be greatly appreciated. Thank you!