I have a user object returned by some function in user.model.js
const user = {
id: "ASwsd122Wqwe1",
name: "sam",
email: "[email protected]",
createdDate : 1721323231123
}
In another file, I'm returning this
const user = getUser();
How do i create a type for user?
You can use
@typedefto create custom types, where@proprefers@propertyare properties in your object.syntax :
@typedef [<type>] <name>In you
user.model.js,In another file, you can import the type like this
above globally defines the type
or