1. rest parameter 문법

function add(...a){
  console.log(a)
}

add(1,2,3,4,5)

2. rest parameter 문법 타입지정

function add(...a:number[]){
  console.log(a)
}

add(1,2,3,4,5)

3. destructuring 문법

4. destructuring 문법 타입지정

const person = { student : true, age : 20 }

function makeUser({student, age}){
  console.log(student, age)
}
makeUser({ student : true, age : 20 })
const person = { student : true, age : 20 }

function makeUser({student, age}:{student:boolean, age:number}){
  console.log(student, age)
}
makeUser({ student : true, age : 20 })

[연습장]

type userType = {
	user :string,
	comment :number[],
	admin :boolean,
}

const makeUser = ({user, comment, admin} : userType):void => {
	console.log(user, comment, admin);
}

makeUser( {user:"Kim", comment:[3,5,4], admin:false})
const wineMaker= ([year, type, isFree]:(number|string|boolean)[]):void => {
	console.log(year, type, isFree);
}

wineMaker([40, 'wine', false])