기본 콘텐츠로 건너뛰기

Typescript 사용법

 

// typescript 설치, npm 이 설치되어 있어야함

npm install -g typescript


// sayHello.ts typescript파일 생성

function sayHello (firstName: string) {
console.log('Hello ' + firstName);
}

let firstName: string = 'Hana';
sayHello(firstName);


// 엄격한 체크를 수행하는 트랜스 명령어

tsc --strictNullChecks sayHello.ts

# 설치

$ npm install -g typescript

# 타입스크립트 파일을 자바스크립트 파일로 변환

$ tsc --strictNullChecks sayHello.ts

# 문자 안에 변수 넣기

`${key} : ${value}` // ' <- 이것과 이것 -> ` 은 다른 문자임에 주의하자!

end

이 블로그의 인기 게시물

Grid 정렬

  .container { display : grid ; gap : 22px ; width : 1000px ; grid-template-columns : repeat ( auto-fit , 150px ); margin : auto ; justify-content : center ; } .container {      display : grid ; gap : 22px ; grid-template-columns : repeat ( auto-fit , minmax ( 250px , 1fr )); }

Python 변수

지역 변수 a 전역 변수 밖에서 선언한 변수를 사용할 때 앞에 global 을 붙여준다     global a