[TypeScript] typescript 설치 & 실행

602·2022년 12월 23일
post-thumbnail

🧵 패키지 설치

① typescript

npm i -g typescript

② ts-node

npm i -g ts-node

image

*한꺼번에 설치할 시 : npm i -g typescript ts-node

🧵 실행

// 1222_01.ts
let hello: string = "hello TS";
console.log(hello);

① 파일 직접 실행

ts-node <파일명>

image

② 파일 컴파일 실행

>tsc <파일명>

컴파일된 js 파일이 생성된다.

image

// 1222_01.js
var hello = "hello TS";
console.log(hello);

>node <파일명>

image

📚 References

https://juntcom.tistory.com/157

profile
프론트엔드 개발자 지망생

0개의 댓글