Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- nextjs
- nextjs .env
- next.js css
- API token
- CSS
- rewrites
- icon
- react
- styled components
- API 토큰
- SCSS
- Git
- react typescript
- ngrok실행
- git lab
- npm styled-reset
- react env
- github io
- input type=file
- typescript react
- createGlobalStyle
- getModifierState
- nextjs 설치
- dart 변수
- 컨디셔널 렌더링
- ngrok설치
- github
- There isn’t anything to compare
- bootstrap
- fetch
Archives
- Today
- Total
꾸준히 성장하는 개발자
[TS] 라이브러리 설치와 tsc 본문
타입스크립트로 프로젝트 시작하는 방법에 대해 알아보자
// index.ts
function sum(a: number, b: number): number {
return a + b;
}
sum(10, 20);
지금 위의 ts파일을 js 파일로 변환을 해줘야 하는데 이를 컴파일(compile)이라고 한다
터미널을 열어주고
npm i typescript -g
로 설치를 진행해주고 설치과 완료되면 아래처럼 입력하여
index.ts 파일을 js 파일로 변환해준다.
tsc index.ts
그럼 위 그림처럼 변환된 index.js 파일이 생성된 것을 확인할 수 있다
타입스크립트 플레이그라운드 사이트
공부하면서 연습하고 변환되는 걸 확인하기 좋은 사이트라서 남겨놓는다
TS Playground - An online editor for exploring TypeScript and JavaScript
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
www.typescriptlang.org
'Typescript' 카테고리의 다른 글
[eslint에러] Delete `␍`eslint prettier/prettier (0) | 2022.10.18 |
---|---|
[TypeScript] interface / Type Aliases(타입 별칭) (0) | 2022.09.16 |
[TypeScript] eslint 노란 밑줄이 나타나지 않을 때 (0) | 2022.09.15 |
TypeScript Basic Types (0) | 2022.01.05 |
TypeScript 란 ? (0) | 2021.12.24 |