Suppose I have two classes Foo and bar, each class has an attribute called fields such as
// Foo
fields = {
id: {
type: 'number',
display: 'ID'
},
name: {
type: 'string',
display: 'Name'
}
// ...
}
// Bar
fields = {
version: {
type: 'number',
display: 'Version'
},
valid: {
type: 'boolean',
display: 'Valid'
}
// ...
}
Fields in these classes have different keys, but each key value has the same type with type and display. Is there a way to define a type or interface for fields?