[typescript] 타입스크립트에서 모듈을 사용하는 방법은 무엇인가요?

다음은 모듈 사용 예제입니다.

// 모듈을 정의하는 파일 (example_module.ts)
export const myVariable: string = "Hello, world!";
export function myFunction(): void {
    console.log("This is a function inside a module.");
}

// 모듈을 가져오는 파일
import { myVariable, myFunction } from './example_module';

console.log(myVariable); // 출력: Hello, world!
myFunction(); // 출력: This is a function inside a module.

모듈을 export하려면 해당 변수나 함수 앞에 export 키워드를 붙이고, 모듈을 가져올 때는 import 키워드를 사용합니다.

더 자세한 내용은 타입스크립트 공식 문서를 참고하시기 바랍니다.