0

I would like to write a function that works with no argument or with 3 arguments but it wouldn't work if the user pass one o two arguments.​ It is possible?

Pablo
  • 2,137
  • 1
  • 17
  • 16

1 Answers1

0

Well I figured out how to do it:

I used an object as optional argument with 3 required key:

initialFetchPosts(query?:{field:string,comparison:any,value:string}){...}

Pablo
  • 2,137
  • 1
  • 17
  • 16