Let's say I have a predefined constant object like this:
const person = {
name: "",
gender: "",
age: 0
}
Then I have a function that requires the parameter must be the type of person:
/**
* @param {*} personObj How can we enforce the personObj as the type of an existing constant object?
*/
function approve(personObj) {
}
How can I enforce the personObj to be the type of person? Is it possible to avoid using @typedef? Because I have many predefined constant objects of such that we do not want to rewrite all the definitions again. Any advice would be appreciated, thank you!