Types when destructuring arrays

后端 未结 5 1769
感动是毒
感动是毒 2020-12-14 05:21
function f([a,b,c]) {
  // this works but a,b and c are any
}

it\'s possible write something like that?

function f([a: number,b: nu         


        
5条回答
  •  [愿得一人]
    2020-12-14 06:10

    As a simple answer I would like to add that you can do this:

    function f([a,b,c]: number[]) {}
    

提交回复
热议问题