함수 메서드 타이핑
함수 및 메서드 타이핑
나머지 매개변수 문법
function example(...args: [number, string, boolean]) {}
example(1, '2', false);
// 각 매개변수에 임의의 이름을 지정하고 싶다면 아래처럼
function example2(...args: [a: number, b: string, c:boolean]) {}함수 내부에서 this를 사용할 때
function example() {
console.log(this); // this: any
}
function exampl2(this: Window) {
console.log(this); // this: Window
}
function example3(this: Document, a: string, b: 'this') {}
example3.call(document, 'hello', 'this');같은 이름의 함수를 여러번 선언
오버로딩 (overloading)
콜백 함수의 매개변수는 생략 가능
공변성과 반공변성
Last updated