interface ModelAttributes {
[name: string]: string | number
}
interface Agent {
id: string
created_date: Date
name: string
city: string | null
email: string | null
phone: string | null
sales_amount: number
}
type AgentAttributes<T extends Agent> = {
[P in keyof T]: ModelAttributes[P] // how to infer field value type from ModelAttributes
}
const modelAttributes: Pick<ModelAttributes, keyof Agent> = {
// ...
}