How to correctly use objects instead of multiple parameters in my case?
class Test{
async createUser(
url: string,
name: string,
email: string,
phone: string,
street: string,
...
) {
await Page.setUrl(url);
await Page.setEmail(email);
...
}
}
use the concept of spread operators. Know more about it here:
create an object variable like this:
result = {
url: string,
name: string,
email: string,
phone: string,
street: string,
}
and then pass it as a parameter like this
async createUser (...result){
//get variable you wan to use
const {url, name, email} = result;
//your code here
}