문서의 이전 판입니다!
There are many types in typescript, but since we love callback function in javascript, how do we declare them in typescript? Let's take a look from the bottom to the top. And with along some practice thinking.
타입스크립트에는 많은 타입들이 있지만, 우리는 자바스크립트의 콜백함수를 선호하는 이유로 해서, 타입스크립트에서는 그것을 어떻게 선언할까? 밑의 예제를 보고 위로 보면서, 예행적 사고를 가지기 바랍니다.
OK, this is the most ugly way to achieve it, you can simply declare a variable as any type, then later, you can assign a function to it. It's not recommend.
<Code:typescript> let a: any;
a = function (): void {
console.log('It works');
} </Code>