사용자 도구

사이트 도구


typescript:deep:type

문서의 이전 판입니다!


Type in Typescript?

How to declare a function type variables in Typescript?

원본

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.

타입스크립트에는 많은 타입들이 있지만, 우리는 자바스크립트의 콜백함수를 선호하는 이유로 해서, 타입스크립트에서는 그것을 어떻게 선언할까? 밑의 예제를 보고 위로 보면서, 예행적 사고를 가지기 바랍니다.

Solution 1 - any

let a: any;
 
a = function (): void {
    console.log('It works');
}

<Code:typescript> let a: any;

a = function (): void {

  console.log('It works');

} </code>

typescript/deep/type.1574089079.txt.gz · 마지막으로 수정됨: 2025/04/15 10:05 (바깥 편집)