728x90
코멘트로 이루어진 문법
함수 바로 위에 코멘트를 적어주면 됨
자바스크립트 파일에서 사용,
제대로 작성하면 타입스크립트가 이 코멘트 읽는 것 가능
즉 js 파일에서 타입스크립트처럼 타입을 지정해주는 것이다.
// @ts-check
/**
* Intialize the code
* @param {object} config
* @param {boolean} config.debug
* @param {string} config.url
* @returns {boolean}
*/
export function init(config){
return true;
}
/**
* exit the program
* @param {number} code
* @returns {number}
*/
export function exit(code){
return code + 1;
}728x90
'Study > Typescript' 카테고리의 다른 글
| build (0) | 2023.07.26 |
|---|---|
| Declaration files (0) | 2023.07.25 |
| tsconfig.json (0) | 2023.07.25 |
| Interfaces (0) | 2023.07.24 |
| Classes (0) | 2023.07.21 |