I have the following object that who's structure I'd like to enforce.
{
'username': {
required: 'Please enter your username.'
},
'passwordGroup': {
ocMatchFields: 'Passwords do not match'
},
'passwordGroup.password': {
required: 'Please enter your password'
},
'passwordGroup.confirmPassword': {
required: 'Please confirm your password'
}
}
It'll never be more deeply nested than shown and the values will always be strings but there can be any number of "fields". fields in this case are first level keys. username, passwordGroup etc.
I had come across something that describes an object as { [key: string]: boolean }
which makes me believe its possible.
I can think of how to represent it as a collection since that would be an array of objects but I'm not sure how I'd be able to describe it as a nested object structure.