2021年4月5日星期一

typescript - object literal with array syntax

I had not come across such a notation:

public station function(a: number,  sort?: { order: -1 | 1; sortBy: string }[] ){  //function body here  }  

Specifially I'm interested in the sort parameter.

I can only understand that sort is an optional argument (I can't even say for sure if it's an object literal since there's no ,).
What does this syntax read? What type of variable is it? Why is there a ; instead of a ,(BTW that is not a typo). What does {...}[] indicate?

https://stackoverflow.com/questions/66961524/typescript-object-literal-with-array-syntax April 06, 2021 at 09:06AM

没有评论:

发表评论