type SelectData = {
name?: boolean;
address?: boolean;
}
const selectData: SelectData = {
name: true
}
const untypedSelectData = {
name: true
}
I am looking to enforce TypeScript to throw an error if there is an attempt to assign a property that does not exist in the SelectData type:
const selectData: SelectData = {
age: true
}
How can I ensure that the type of selectData remains consistent with untypedSelectData ({name: boolean})?